Skip to content

Commit f32de5f

Browse files
authored
Update 1.2.0: Compatibility with Heads 2.0
Merge pull request #6 from KCodeYT/pr/2.0-compatibility
2 parents 30d0092 + 0ae8da1 commit f32de5f

6 files changed

Lines changed: 58 additions & 25 deletions

File tree

.github/images/banner.png

49.1 KB
Loading

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ jobs:
1111
- name: Checkout github repository
1212
uses: actions/checkout@v3
1313

14-
- name: Set up JDK 17
14+
- name: Set up JDK 8
1515
uses: actions/setup-java@v3
1616
with:
17-
java-version: '17'
17+
java-version: '8'
1818
distribution: 'temurin'
1919
cache: maven
2020

21-
- name: Clone HeadsPlugin
21+
- name: Clone HeadsPlugin repository
2222
uses: sudosubin/git-clone-action@v1.0.1
2323
with:
2424
repository: KCodeYT/Heads
2525
ref: release
2626
path: Heads
2727

28-
- name: Install HeadsPlugin
28+
- name: Install HeadsPlugin repository
2929
run: cd Heads && mvn install
3030

3131
- name: Get name and version from pom.xml

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
![banner](./.github/images/banner.png)
2+
3+
What is this?
4+
------------------------------
5+
6+
This project is an additional plugin for the Heads plugin. (Which can be
7+
found [here](https://github.com/KCodeYT/Heads/))
8+
This plugin adds a database to the Heads plugin, so you can access more heads.
9+
10+
How can I download this plugin?
11+
------------------------------
12+
13+
You can find the downloads on the [releases section](https://github.com/KCodeYT/HeadsDatabase/releases) of this github
14+
page.
15+
There you can find the LATEST jar file of this plugin.
16+
17+
How can I access the database?
18+
------------------------------
19+
20+
1. Open the chat in your client.
21+
2. Ensure you have the operator status on the server or have the permission "headsdb.command.hdb",
22+
otherwise you will not be able to use this command.
23+
3. Type /hdb.
24+
4. You now see a GUI in which you can select a category of heads that are in the database.
25+
5. Select a category and you can select a head from that category.
26+
6. By selecting a head, the head will be given to you.

pom.xml

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,14 @@
66

77
<groupId>de.kcodeyt</groupId>
88
<artifactId>HeadsDatabase</artifactId>
9-
<version>1.1.0</version>
9+
<version>1.2.0</version>
1010

11-
<build>
12-
<plugins>
13-
<plugin>
14-
<groupId>org.apache.maven.plugins</groupId>
15-
<artifactId>maven-compiler-plugin</artifactId>
16-
<version>3.1</version>
17-
<configuration>
18-
<source>8</source>
19-
<target>8</target>
20-
</configuration>
21-
</plugin>
22-
</plugins>
23-
</build>
11+
<properties>
12+
<maven.compiler.source>1.8</maven.compiler.source>
13+
<maven.compiler.target>1.8</maven.compiler.target>
14+
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
15+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
16+
</properties>
2417

2518
<repositories>
2619
<repository>
@@ -49,7 +42,7 @@
4942
<dependency>
5043
<groupId>de.kcodeyt</groupId>
5144
<artifactId>Heads</artifactId>
52-
<version>1.1.1</version>
45+
<version>2.0.0</version>
5346
</dependency>
5447
<dependency>
5548
<groupId>cn.nukkit</groupId>
@@ -63,4 +56,18 @@
6356
</dependency>
6457
</dependencies>
6558

59+
<build>
60+
<plugins>
61+
<plugin>
62+
<groupId>org.apache.maven.plugins</groupId>
63+
<artifactId>maven-compiler-plugin</artifactId>
64+
<version>3.1</version>
65+
<configuration>
66+
<source>1.8</source>
67+
<target>1.8</target>
68+
<encoding>UTF-8</encoding>
69+
</configuration>
70+
</plugin>
71+
</plugins>
72+
</build>
6673
</project>

src/main/java/de/kcodeyt/headsdb/database/Database.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
import cn.nukkit.utils.TextFormat;
2727
import com.google.common.collect.Iterables;
2828
import com.google.gson.Gson;
29-
import de.kcodeyt.heads.Heads;
30-
import de.kcodeyt.heads.util.HeadInput;
29+
import de.kcodeyt.heads.api.HeadAPI;
30+
import de.kcodeyt.heads.api.SkullOwnerResolveMethod;
3131
import de.kcodeyt.heads.util.PluginHolder;
3232
import de.kcodeyt.heads.util.ScheduledFuture;
3333
import de.kcodeyt.headsdb.HeadsDB;
@@ -285,14 +285,14 @@ private void showForm(Player player, FormWindow lastWindow, List<HeadEntry> head
285285
}
286286

287287
public void giveItem(Player player, HeadEntry headEntry) {
288-
Heads.createItem(HeadInput.ofTexture(headEntry.getTexture(), headEntry.getId())).whenComplete((result, throwable) -> {
288+
HeadAPI.resolveSkullOwner(headEntry.getTexture(), SkullOwnerResolveMethod.TEXTURE).whenComplete((skullOwner, throwable) -> {
289289
if(throwable != null) {
290-
player.sendMessage("§cCould not create the requested skull item!");
290+
player.sendMessage(PluginHolder.get().getLanguage().translate(player, de.kcodeyt.heads.lang.TranslationKey.ERROR_WHILE_GIVING_HEAD));
291291
throwable.printStackTrace();
292292
return;
293293
}
294294

295-
final Item item = result.getItem();
295+
final Item item = HeadAPI.createSkullItemByOwner(skullOwner);
296296
item.setCustomName("§r§7" + headEntry.getName());
297297
final Item[] drops = player.getInventory().addItem(item);
298298
if(drops.length > 0) {

src/main/resources/plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: HeadsDatabase
2-
version: "1.0.1"
2+
version: "1.2.0"
33
api: ["1.0.0"]
44
main: de.kcodeyt.headsdb.HeadsDB
55
depend:

0 commit comments

Comments
 (0)