Skip to content

Commit 280459e

Browse files
authored
Merge pull request #5 from imDaniX/master
Обновление под 1.14+
2 parents 19753a3 + e958a7e commit 280459e

File tree

10 files changed

+226
-145
lines changed

10 files changed

+226
-145
lines changed

.github/workflows/maven.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Java CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
11+
if: "! contains(toJSON(github.event.commits.*.message), '[SKIP-CI]')"
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Set up JDK 1.8
18+
uses: actions/setup-java@v1
19+
with:
20+
java-version: 1.8
21+
22+
- uses: actions/cache@v1
23+
with:
24+
path: ~/.m2/repository
25+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
26+
restore-keys: |
27+
${{ runner.os }}-maven-
28+
- name: Build with Maven
29+
run: mvn -B package --file pom.xml
30+
- uses: actions/upload-artifact@main
31+
with:
32+
name: MarkItem
33+
path: target/markitem-*

.gitignore

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
/nbproject/
2-
build.xml
3-
/build/
4-
/dist/
1+
/nbproject/
2+
build.xml
3+
/build/
4+
/dist/
5+
/.idea/
6+
MarkItem.iml
7+
/target/

pom.xml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>ru.endlesscode.markitem</groupId>
8+
<artifactId>markitem</artifactId>
9+
<version>0.5</version>
10+
<packaging>jar</packaging>
11+
12+
<name>MarkItem</name>
13+
14+
<description>Mark your items</description>
15+
<properties>
16+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
17+
</properties>
18+
19+
<build>
20+
<defaultGoal>clean package</defaultGoal>
21+
<sourceDirectory>src</sourceDirectory>
22+
<plugins>
23+
<plugin>
24+
<groupId>org.apache.maven.plugins</groupId>
25+
<artifactId>maven-compiler-plugin</artifactId>
26+
<version>3.7.0</version>
27+
<configuration>
28+
<source>1.8</source>
29+
<target>1.8</target>
30+
</configuration>
31+
</plugin>
32+
<plugin>
33+
<groupId>org.apache.maven.plugins</groupId>
34+
<artifactId>maven-shade-plugin</artifactId>
35+
<version>3.1.0</version>
36+
<executions>
37+
<execution>
38+
<phase>package</phase>
39+
<goals>
40+
<goal>shade</goal>
41+
</goals>
42+
<configuration>
43+
<filters>
44+
<filter>
45+
<artifact>*:*</artifact>
46+
<excludes>
47+
<exclude>META-INF/maven/**</exclude>
48+
</excludes>
49+
</filter>
50+
</filters>
51+
</configuration>
52+
</execution>
53+
</executions>
54+
</plugin>
55+
</plugins>
56+
<resources>
57+
<resource>
58+
<directory>res</directory>
59+
<filtering>true</filtering>
60+
</resource>
61+
</resources>
62+
</build>
63+
64+
<repositories>
65+
<repository>
66+
<id>papermc</id>
67+
<url>https://papermc.io/repo/repository/maven-public/</url>
68+
</repository>
69+
</repositories>
70+
71+
<dependencies>
72+
<dependency>
73+
<groupId>com.destroystokyo.paper</groupId>
74+
<artifactId>paper-api</artifactId>
75+
<version>1.15.2-R0.1-SNAPSHOT</version>
76+
<scope>provided</scope>
77+
</dependency>
78+
</dependencies>
79+
</project>

res/config.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
enabled: true
22
mark:
3-
texture: INK_SACK:1
3+
texture: RED_DYE
44
glow: false
55
name: "&9Mark"
66
lore: "&e&oYou can mark your items and they do not drop when death"
77
text: "&9- Item is marked"
88

9+
# Update marked items from old version of the plugin (up to 0.4, doesn't work for servers on 1.16)
10+
update: false
11+
912
##
1013
# Allowed and denied items
1114
# ------------------------------------------
12-
# You can use a range of values, eg 1-100
13-
# Also you can use item metadata (durability), eg 351#14
15+
# You can use a regex for matching materials, eg diamond_.*
1416
##
1517
allowed:
16-
- 256-258
17-
- 267-279
18-
- 283-286
19-
- 290-294
20-
- 298-317
21-
- 346
18+
- iron_.+
19+
- diamond_chestplate
20+
- (cross)?bow
21+
- .+_leggings
2222
denied:
23-
- 268-271
24-
- 290
23+
- iron_h.*
24+
- chainmal_leggings

res/plugin.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: MarkItem
2-
version: 0.4
2+
version: ${project.version}
33
description: Mark your items
44
authors: [OsipXD, Dereku]
5+
api-version: '1.14'
56

67
main: ru.endlesscode.markitem.MarkItem
78

src/ru/endlesscode/markitem/CommandExecutor.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ public static void giveMark(CommandSender sender) {
1919

2020

2121
public static void giveMark(CommandSender sender, String name) {
22-
@SuppressWarnings("deprecation")
2322
Player player = MarkItem.getInstance().getServer().getPlayer(name);
2423

2524
if (player == null) {

src/ru/endlesscode/markitem/Glow.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,8 @@
1515
class Glow extends EnchantmentWrapper {
1616
private static final Enchantment GLOW = new Glow();
1717

18-
static {
19-
try {
20-
Field field = Enchantment.class.getDeclaredField("acceptingNew");
21-
field.setAccessible(true);
22-
field.set(null, true);
23-
24-
Enchantment.registerEnchantment(GLOW);
25-
} catch (Exception ignored) {}
26-
}
27-
2818
private Glow() {
29-
super(69);
19+
super("glow_effect");
3020
}
3121

3222
@Override
@@ -41,7 +31,7 @@ public boolean conflictsWith(Enchantment other) {
4131

4232
@Override
4333
public EnchantmentTarget getItemTarget() {
44-
return null;
34+
return EnchantmentTarget.ALL;
4535
}
4636

4737
@Override
@@ -62,4 +52,14 @@ public int getStartLevel() {
6252
public static void addGlow(ItemStack item) {
6353
item.addEnchantment(GLOW, 1);
6454
}
55+
56+
public static void register() {
57+
try {
58+
Field acceptingNew = Enchantment.class.getDeclaredField("acceptingNew");
59+
acceptingNew.setAccessible(true);
60+
acceptingNew.set(null, true);
61+
Enchantment.registerEnchantment(GLOW);
62+
} catch (Exception ignored) {
63+
}
64+
}
6565
}

0 commit comments

Comments
 (0)