mirror of
https://github.com/songoda/SongodaCore.git
synced 2024-11-23 18:45:34 +01:00
Merge branch 'development'
This commit is contained in:
commit
2f7c165c01
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>SongodaCore-Modules</artifactId>
|
<artifactId>SongodaCore-Modules</artifactId>
|
||||||
<version>2.4.38</version>
|
<version>2.4.39</version>
|
||||||
<relativePath>../</relativePath>
|
<relativePath>../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ public class SongodaCore {
|
|||||||
/**
|
/**
|
||||||
* This has been added as of Rev 6
|
* This has been added as of Rev 6
|
||||||
*/
|
*/
|
||||||
private final static String coreVersion = "2.4.38";
|
private final static String coreVersion = "2.4.39";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is specific to the website api
|
* This is specific to the website api
|
||||||
|
@ -7,6 +7,7 @@ import com.mojang.authlib.GameProfile;
|
|||||||
import com.mojang.authlib.properties.Property;
|
import com.mojang.authlib.properties.Property;
|
||||||
import com.songoda.core.compatibility.CompatibleHand;
|
import com.songoda.core.compatibility.CompatibleHand;
|
||||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||||
|
import com.songoda.core.compatibility.CompatibleSound;
|
||||||
import com.songoda.core.compatibility.ServerVersion;
|
import com.songoda.core.compatibility.ServerVersion;
|
||||||
import com.songoda.core.nms.NmsManager;
|
import com.songoda.core.nms.NmsManager;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
@ -120,21 +121,38 @@ public class ItemUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack addDamage(ItemStack item, int damage) {
|
public static ItemStack addDamage(ItemStack item, int damage) {
|
||||||
if (item == null) {
|
return addDamage(null, item, damage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack addDamage(Player player, ItemStack item, int damage) {
|
||||||
|
if (item == null)
|
||||||
return null;
|
return null;
|
||||||
} else if (ServerVersion.isServerVersionBelow(ServerVersion.V1_11)
|
|
||||||
? NmsManager.getNbt().of(item).has("Unbreakable")
|
int maxDurability = item.getType().getMaxDurability();
|
||||||
: item.getItemMeta().isUnbreakable()) {
|
int durability;
|
||||||
|
|
||||||
|
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_11)
|
||||||
|
? NmsManager.getNbt().of(item).has("Unbreakable")
|
||||||
|
: item.getItemMeta().isUnbreakable()) {
|
||||||
return item;
|
return item;
|
||||||
} else if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) {
|
} else if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) {
|
||||||
// ItemStack.setDurability(short) still works in 1.13-1.14, but use these methods now
|
// ItemStack.setDurability(short) still works in 1.13-1.14, but use these methods now
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
if (meta instanceof Damageable) {
|
if (meta instanceof Damageable) {
|
||||||
((Damageable) meta).setDamage(((Damageable) meta).getDamage() + damage);
|
Damageable damageable = ((Damageable) meta);
|
||||||
|
damageable.setDamage(((Damageable) meta).getDamage() + damage);
|
||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
|
durability = damageable.getDamage();
|
||||||
|
} else {
|
||||||
|
return item;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
item.setDurability((short) Math.max(0, item.getDurability() + damage));
|
item.setDurability((short) Math.max(0, item.getDurability() + damage));
|
||||||
|
durability = item.getDurability();
|
||||||
|
}
|
||||||
|
if (durability >= maxDurability && player != null) {
|
||||||
|
player.getInventory().removeItem(item);
|
||||||
|
CompatibleSound.ENTITY_ITEM_BREAK.play(player);
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>SongodaCore-Modules</artifactId>
|
<artifactId>SongodaCore-Modules</artifactId>
|
||||||
<version>2.4.38</version>
|
<version>2.4.39</version>
|
||||||
<relativePath>../../</relativePath>
|
<relativePath>../../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>SongodaCore-Modules</artifactId>
|
<artifactId>SongodaCore-Modules</artifactId>
|
||||||
<version>2.4.38</version>
|
<version>2.4.39</version>
|
||||||
<relativePath>../../</relativePath>
|
<relativePath>../../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>SongodaCore-Modules</artifactId>
|
<artifactId>SongodaCore-Modules</artifactId>
|
||||||
<version>2.4.38</version>
|
<version>2.4.39</version>
|
||||||
<relativePath>../../</relativePath>
|
<relativePath>../../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>SongodaCore-Modules</artifactId>
|
<artifactId>SongodaCore-Modules</artifactId>
|
||||||
<version>2.4.38</version>
|
<version>2.4.39</version>
|
||||||
<relativePath>../../</relativePath>
|
<relativePath>../../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>SongodaCore-Modules</artifactId>
|
<artifactId>SongodaCore-Modules</artifactId>
|
||||||
<version>2.4.38</version>
|
<version>2.4.39</version>
|
||||||
<relativePath>../../</relativePath>
|
<relativePath>../../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>SongodaCore-Modules</artifactId>
|
<artifactId>SongodaCore-Modules</artifactId>
|
||||||
<version>2.4.38</version>
|
<version>2.4.39</version>
|
||||||
<relativePath>../../</relativePath>
|
<relativePath>../../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>SongodaCore-Modules</artifactId>
|
<artifactId>SongodaCore-Modules</artifactId>
|
||||||
<version>2.4.38</version>
|
<version>2.4.39</version>
|
||||||
<relativePath>../../</relativePath>
|
<relativePath>../../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>SongodaCore-Modules</artifactId>
|
<artifactId>SongodaCore-Modules</artifactId>
|
||||||
<version>2.4.38</version>
|
<version>2.4.39</version>
|
||||||
<relativePath>../../</relativePath>
|
<relativePath>../../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>SongodaCore-Modules</artifactId>
|
<artifactId>SongodaCore-Modules</artifactId>
|
||||||
<version>2.4.38</version>
|
<version>2.4.39</version>
|
||||||
<relativePath>../../</relativePath>
|
<relativePath>../../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>SongodaCore-Modules</artifactId>
|
<artifactId>SongodaCore-Modules</artifactId>
|
||||||
<version>2.4.38</version>
|
<version>2.4.39</version>
|
||||||
<relativePath>../../</relativePath>
|
<relativePath>../../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>SongodaCore-Modules</artifactId>
|
<artifactId>SongodaCore-Modules</artifactId>
|
||||||
<version>2.4.38</version>
|
<version>2.4.39</version>
|
||||||
<relativePath>../../</relativePath>
|
<relativePath>../../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>SongodaCore-Modules</artifactId>
|
<artifactId>SongodaCore-Modules</artifactId>
|
||||||
<version>2.4.38</version>
|
<version>2.4.39</version>
|
||||||
<relativePath>../../</relativePath>
|
<relativePath>../../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>SongodaCore-Modules</artifactId>
|
<artifactId>SongodaCore-Modules</artifactId>
|
||||||
<version>2.4.38</version>
|
<version>2.4.39</version>
|
||||||
<relativePath>../../</relativePath>
|
<relativePath>../../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>SongodaCore-Modules</artifactId>
|
<artifactId>SongodaCore-Modules</artifactId>
|
||||||
<version>2.4.38</version>
|
<version>2.4.39</version>
|
||||||
<relativePath>../../</relativePath>
|
<relativePath>../../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>SongodaCore-Modules</artifactId>
|
<artifactId>SongodaCore-Modules</artifactId>
|
||||||
<version>2.4.38</version>
|
<version>2.4.39</version>
|
||||||
<relativePath>../../</relativePath>
|
<relativePath>../../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>SongodaCore-Modules</artifactId>
|
<artifactId>SongodaCore-Modules</artifactId>
|
||||||
<version>2.4.38</version>
|
<version>2.4.39</version>
|
||||||
<relativePath>../../</relativePath>
|
<relativePath>../../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ Maven Information
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>SongodaCore</artifactId>
|
<artifactId>SongodaCore</artifactId>
|
||||||
<version>2.4.38</version>
|
<version>2.4.39</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
@ -37,6 +37,6 @@ repositories {
|
|||||||
* Artifact:
|
* Artifact:
|
||||||
```groovy
|
```groovy
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly 'com.songoda:SongodaCore:2.4.38'
|
compileOnly 'com.songoda:SongodaCore:2.4.39'
|
||||||
}
|
}
|
||||||
```
|
```
|
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>SongodaCore-Modules</artifactId>
|
<artifactId>SongodaCore-Modules</artifactId>
|
||||||
<version>2.4.38</version>
|
<version>2.4.39</version>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user