1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 14:05:25 +01:00

Merge branch 'master' into montlikadani-patch-3

This commit is contained in:
montlikadani 2018-08-20 13:06:54 +02:00 committed by GitHub
commit f9d4dc2e7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 78 additions and 70 deletions

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>Jobs</groupId>
<artifactId>jobs</artifactId>
<version>4.5.1</version>
<version>4.7.2</version>
<name>Jobs</name>
<url>http://maven.apache.org</url>
<properties>
@ -16,7 +16,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.12-R0.1-SNAPSHOT</version>
<version>1.13-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- iConomy7 -->

View File

@ -18,6 +18,7 @@ import org.bukkit.inventory.Recipe;
import org.bukkit.inventory.meta.SkullMeta;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.stuff.Debug;
import com.gamingmesh.jobs.stuff.VersionChecker.Version;
public class ItemManager {
@ -26,10 +27,10 @@ public class ItemManager {
static HashMap<String, CMIItemStack> byBukkitName = new HashMap<>();
static HashMap<String, CMIItemStack> byMojangName = new HashMap<>();
static HashMap<CMIMaterial, CMIItemStack> byMaterial = new HashMap<>();
static Version version;
static final Version version = Jobs.getVersionCheckManager().getVersion();
public static void load() {
version = Jobs.getVersionCheckManager().getVersion();
for (CMIMaterial one : CMIMaterial.values()) {
if (one == null)
continue;
@ -2187,13 +2188,17 @@ public class ItemManager {
}
public static boolean isDye(Material mat) {
Debug.D("ss1");
CMIMaterial m = CMIMaterial.get(mat);
Debug.D("ss2");
if (m == null)
return false;
Debug.D("ss3");
return m.isDye();
}
public boolean isDye() {
Debug.D("ss4");
switch (this) {
case INK_SAC:
case ROSE_RED:
@ -2254,25 +2259,62 @@ public class ItemManager {
}
public static SlabType getSlabType(Block block) {
if (!isSlab(block.getType()))
return checkSlab(block);
}
public boolean equals(Material mat) {
if (getMaterial() == null)
return false;
return this.getMaterial().equals(mat);
}
public String getLegacyName() {
return legacyName == null ? "" : legacyName;
}
public void setLegacyName(String legacyName) {
this.legacyName = legacyName;
}
public String getBukkitName() {
if (bukkitName == null)
bukkitName = getMaterial().name();
return bukkitName;
}
public void setBukkitName(String bukkitName) {
this.bukkitName = bukkitName;
}
public String getMojangName() {
if (mojangName == null)
mojangName = ItemReflection.getItemMinecraftName(this.newItemStack());
return mojangName;
}
public void setMojangName(String mojangName) {
this.mojangName = mojangName;
}
}
private static SlabType checkSlab(Block block) throws NoClassDefFoundError {
if (!CMIMaterial.isSlab(block.getType()))
return SlabType.NOTSLAB;
if (Jobs.getVersionCheckManager().getVersion().isEqualOrHigher(Version.v1_13_R1)) {
if (version.isEqualOrHigher(Version.v1_13_R1)) {
if (block.getBlockData() instanceof org.bukkit.block.data.type.Slab) {
org.bukkit.block.data.type.Slab slab = (org.bukkit.block.data.type.Slab) block.getBlockData();
switch (slab.getType()) {
case TOP:
org.bukkit.block.data.type.Slab.Type t = slab.getType();
if (t.equals(org.bukkit.block.data.type.Slab.Type.TOP))
return SlabType.TOP;
case BOTTOM:
if (t.equals(org.bukkit.block.data.type.Slab.Type.BOTTOM))
return SlabType.BOTTOM;
case DOUBLE:
if (t.equals(org.bukkit.block.data.type.Slab.Type.DOUBLE))
return SlabType.DOUBLE;
}
}
return SlabType.NOTSLAB;
}
s: if (block.getType().name().contains("STEP")) {
if (block.getType().name().contains("STEP")) {
switch (CMIMaterial.get(block).getLegacyId()) {
case 44:
switch (block.getData()) {
@ -2320,41 +2362,6 @@ public class ItemManager {
return SlabType.NOTSLAB;
}
public boolean equals(Material mat) {
if (getMaterial() == null)
return false;
return this.getMaterial().equals(mat);
}
public String getLegacyName() {
return legacyName == null ? "" : legacyName;
}
public void setLegacyName(String legacyName) {
this.legacyName = legacyName;
}
public String getBukkitName() {
if (bukkitName == null)
bukkitName = getMaterial().name();
return bukkitName;
}
public void setBukkitName(String bukkitName) {
this.bukkitName = bukkitName;
}
public String getMojangName() {
if (mojangName == null)
mojangName = ItemReflection.getItemMinecraftName(this.newItemStack());
return mojangName;
}
public void setMojangName(String mojangName) {
this.mojangName = mojangName;
}
}
public enum SlabType {
TOP,
BOTTOM,

View File

@ -574,6 +574,7 @@ public class JobsPaymentListener implements Listener {
if (sourceItems[i] == null)
continue;
Debug.D("ss");
if (CMIMaterial.isDye(sourceItems[i].getType()))
DyeStack.add(sourceItems[i]);

View File

@ -92,8 +92,8 @@ public class VersionChecker {
return getValue() >= version.getValue();
}
public static boolean isCurrentEqualOrHigher(Version version) {
return version.getValue() >= version.getValue();
public static boolean isCurrentEqualOrHigher(Version v) {
return version.getValue() >= v.getValue();
}
}