Skip to content

Commit

Permalink
chore: use github package
Browse files Browse the repository at this point in the history
  • Loading branch information
StarWishsama committed Oct 7, 2023
1 parent 9e25b14 commit 9e14b70
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 15 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/github-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Github Package

on:
push:
branches:
- main
paths:
- 'src/**'
- 'pom.xml'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
java-package: jdk
architecture: x64
cache: maven
server-id: github
settings-path: ${{ github.workspace }}
- name: Build dough
if: github.event_name != 'pull_request'
run: mvn -B package --file pom.xml --errors
- name: Publish dough
if: github.event_name != 'pull_request'
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml --file pom.xml --errors
env:
GITHUB_TOKEN: ${{ github.token }}
16 changes: 16 additions & 0 deletions .github/workflows/package-maintainer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Package Maintainer

on:
workflow_dispatch:
schedule:
- cron: '0 17 * * *'

jobs:
delete-package-versions:
runs-on: ubuntu-latest
steps:
- uses: actions/delete-package-versions@v4
with:
package-name: 'io.github.baked-libs.dough'
package-type: 'maven'
min-versions-to-keep: 2
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
package io.github.bakedlibs.dough.skins;

import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import io.github.bakedlibs.dough.reflection.ReflectionUtils;
import java.util.UUID;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import org.bukkit.Bukkit;
import org.bukkit.inventory.meta.SkullMeta;

import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;

import io.github.bakedlibs.dough.reflection.ReflectionUtils;

final class CustomGameProfile extends GameProfile {

/**
Expand All @@ -37,7 +34,7 @@ void apply(@Nonnull SkullMeta meta) throws NoSuchFieldException, IllegalAccessEx
ReflectionUtils.setFieldValue(meta, "profile", this);

// Forces SkullMeta to properly deserialize and serialize the profile
meta.setOwningPlayer(meta.getOwningPlayer());
meta.setOwnerProfile(Bukkit.createPlayerProfile(meta.getOwningPlayer().getUniqueId(), PLAYER_NAME));

// Now override the texture again
ReflectionUtils.setFieldValue(meta, "profile", this);
Expand Down
10 changes: 3 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,10 @@
</issueManagement>

<distributionManagement>
<snapshotRepository>
<id>osshr</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>

<repository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
<id>github</id>
<name>GitHub StarWishsama Apache Maven Packages</name>
<url>https://maven.pkg.github.com/StarWishsama/dough</url>
</repository>
</distributionManagement>

Expand Down

0 comments on commit 9e14b70

Please sign in to comment.