mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-25 20:16:13 +01:00
Small step for a man...
This commit is contained in:
parent
23dee5d93e
commit
6ad9b86d3b
16
pom.xml
16
pom.xml
@ -182,14 +182,14 @@
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- <plugin> -->
|
||||
<!-- <groupId>org.apache.maven.plugins</groupId> -->
|
||||
<!-- <artifactId>maven-jar-plugin</artifactId> -->
|
||||
<!-- <version>2.3.1</version> -->
|
||||
<!-- <configuration> -->
|
||||
<!-- <outputDirectory>C:\Users\Arte\Desktop\Server 1.14\plugins</outputDirectory> -->
|
||||
<!-- </configuration> -->
|
||||
<!-- </plugin> -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.3.1</version>
|
||||
<configuration>
|
||||
<outputDirectory>C:\Users\Arte\Desktop\Server 1.14\plugins</outputDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
@ -78,47 +78,6 @@ public class Reflections {
|
||||
return Class.forName("net.minecraft.server." + Jobs.getVersionCheckManager().getVersion() + "." + nmsClassString);
|
||||
}
|
||||
|
||||
public String getItemMinecraftName(ItemStack item) {
|
||||
try {
|
||||
Object nmsStack = asNMSCopy(item);
|
||||
Method itemMeth = Item.getMethod("getById", int.class);
|
||||
@SuppressWarnings("deprecation")
|
||||
Object res = itemMeth.invoke(Item, item.getType().getId());
|
||||
|
||||
String ff = "b";
|
||||
switch (Jobs.getVersionCheckManager().getVersion()) {
|
||||
case v1_10_R1:
|
||||
case v1_9_R1:
|
||||
case v1_9_R2:
|
||||
case v1_8_R1:
|
||||
case v1_8_R3:
|
||||
case v1_8_R2:
|
||||
ff = "a";
|
||||
break;
|
||||
case v1_11_R1:
|
||||
case v1_12_R1:
|
||||
case v1_13_R2:
|
||||
case v1_13_R1:
|
||||
ff = "b";
|
||||
break;
|
||||
case v1_7_R1:
|
||||
case v1_7_R2:
|
||||
case v1_7_R3:
|
||||
case v1_7_R4:
|
||||
ff = "n";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Method meth2 = res.getClass().getMethod(ff, IStack);
|
||||
Object name = meth2.invoke(res, nmsStack);
|
||||
return name.toString();
|
||||
} catch (Throwable e) {
|
||||
return item != null ? item.getType().name() : "";
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack removeNbt(ItemStack item, String base, String path) {
|
||||
if (item == null)
|
||||
return null;
|
||||
|
@ -33,8 +33,11 @@ import com.gamingmesh.jobs.CMILib.ItemManager.CMIMaterial;
|
||||
|
||||
public class JobLimitedItems {
|
||||
private String node;
|
||||
@Deprecated
|
||||
private int id;
|
||||
@Deprecated
|
||||
private int data;
|
||||
CMIMaterial mat;
|
||||
private int amount;
|
||||
private String name;
|
||||
private List<String> lore;
|
||||
@ -58,8 +61,8 @@ public class JobLimitedItems {
|
||||
|
||||
public ItemStack getItemStack(Player player) {
|
||||
try {
|
||||
CMIMaterial cm = CMIMaterial.get(id, data);
|
||||
ItemStack item = cm.newItemStack();
|
||||
mat = CMIMaterial.get(id, data);
|
||||
ItemStack item = mat.newItemStack();
|
||||
item.setAmount(amount);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (this.name != null)
|
||||
@ -83,9 +86,14 @@ public class JobLimitedItems {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public CMIMaterial getType(){
|
||||
return mat;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
|
@ -20,31 +20,31 @@ package com.gamingmesh.jobs.container;
|
||||
|
||||
public class NameList {
|
||||
|
||||
private String id;
|
||||
private String meta;
|
||||
private String Name;
|
||||
private String MinecraftName;
|
||||
private String id;
|
||||
private String meta;
|
||||
private String Name;
|
||||
private String MinecraftName;
|
||||
|
||||
public NameList(String id, String meta, String Name, String MinecraftName) {
|
||||
this.id = id;
|
||||
this.meta = meta;
|
||||
this.Name = Name;
|
||||
this.MinecraftName = MinecraftName;
|
||||
}
|
||||
public NameList(String id, String meta, String Name, String MinecraftName) {
|
||||
this.id = id;
|
||||
this.meta = meta;
|
||||
this.Name = Name;
|
||||
this.MinecraftName = MinecraftName;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return Name;
|
||||
}
|
||||
public String getName() {
|
||||
return Name;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getMeta() {
|
||||
return meta;
|
||||
}
|
||||
public String getMeta() {
|
||||
return meta;
|
||||
}
|
||||
|
||||
public String getMinecraftName() {
|
||||
return MinecraftName;
|
||||
}
|
||||
public String getMinecraftName() {
|
||||
return MinecraftName;
|
||||
}
|
||||
}
|
||||
|
@ -691,7 +691,7 @@ public class JobsListener implements Listener {
|
||||
for (Entry<String, JobLimitedItems> oneItem : one.getJob().getLimitedItems().entrySet()) {
|
||||
if (one.getLevel() >= oneItem.getValue().getLevel())
|
||||
continue;
|
||||
if (!isThisItem(oneItem.getValue(), iih.getType().getId(), name, lore, enchants))
|
||||
if (!isThisItem(oneItem.getValue(), CMIMaterial.get(iih), name, lore, enchants))
|
||||
continue;
|
||||
meinOk = one.getJob().getName();
|
||||
break mein;
|
||||
@ -704,9 +704,9 @@ public class JobsListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isThisItem(JobLimitedItems oneItem, int id, String name, List<String> lore, Map<Enchantment, Integer> enchants) {
|
||||
private static boolean isThisItem(JobLimitedItems oneItem, CMIMaterial mat, String name, List<String> lore, Map<Enchantment, Integer> enchants) {
|
||||
|
||||
if (oneItem.getId() != id)
|
||||
if (oneItem.getType() != mat)
|
||||
return false;
|
||||
|
||||
if (oneItem.getName() != null && name != null) {
|
||||
|
@ -581,9 +581,9 @@ public class JobsPaymentListener implements Listener {
|
||||
// For dye check
|
||||
List<ItemStack> DyeStack = new ArrayList<>();
|
||||
int y = -1;
|
||||
int first = 0;
|
||||
int second = 0;
|
||||
int third = 0;
|
||||
CMIMaterial first = null;
|
||||
CMIMaterial second = null;
|
||||
CMIMaterial third = null;
|
||||
boolean leather = false;
|
||||
for (int i = 0; i < sourceItems.length; i++) {
|
||||
if (sourceItems[i] == null)
|
||||
@ -592,15 +592,15 @@ public class JobsPaymentListener implements Listener {
|
||||
if (CMIMaterial.isDye(sourceItems[i].getType()))
|
||||
DyeStack.add(sourceItems[i]);
|
||||
|
||||
int id = sourceItems[i].getType().getId();
|
||||
if (id > 0) {
|
||||
CMIMaterial mat = CMIMaterial.get(sourceItems[i]);
|
||||
if (mat != CMIMaterial.NONE) {
|
||||
y++;
|
||||
if (y == 0)
|
||||
first = id;
|
||||
first = mat;
|
||||
if (y == 1)
|
||||
second = id;
|
||||
second = mat;
|
||||
if (y == 2)
|
||||
third = id;
|
||||
third = mat;
|
||||
}
|
||||
|
||||
switch (CMIMaterial.get(sourceItems[i])) {
|
||||
@ -624,7 +624,7 @@ public class JobsPaymentListener implements Listener {
|
||||
|
||||
// Check Dyes
|
||||
if (y >= 2) {
|
||||
if ((CMIMaterial.get(third).isDye() || CMIMaterial.get(second).isDye()) && leather) {
|
||||
if ((third != null && third.isDye() || second != null && second.isDye()) && leather) {
|
||||
Jobs.action(jPlayer, new ItemActionInfo(sourceItems[0], ActionType.DYE));
|
||||
for (ItemStack OneDye : DyeStack) {
|
||||
Jobs.action(jPlayer, new ItemActionInfo(OneDye, ActionType.DYE));
|
||||
@ -715,7 +715,9 @@ public class JobsPaymentListener implements Listener {
|
||||
return b == null;
|
||||
else if (b == null)
|
||||
return false;
|
||||
return a.getType().getId() == b.getType().getId() && a.getDurability() == b.getDurability() && Objects.equal(a.getData(), b.getData()) && Objects.equal(a.getEnchantments(), b
|
||||
CMIMaterial mat1 = CMIMaterial.get(a);
|
||||
CMIMaterial mat2 = CMIMaterial.get(b);
|
||||
return mat1 == mat2 && a.getDurability() == b.getDurability() && Objects.equal(a.getData(), b.getData()) && Objects.equal(a.getEnchantments(), b
|
||||
.getEnchantments());
|
||||
}
|
||||
|
||||
@ -807,19 +809,19 @@ public class JobsPaymentListener implements Listener {
|
||||
if (Jobs.getGCManager().PayForEnchantingOnAnvil && inv.getItem(1).getType().equals(Material.ENCHANTED_BOOK)) {
|
||||
Map<Enchantment, Integer> enchants = resultStack.getEnchantments();
|
||||
for (Entry<Enchantment, Integer> oneEnchant : enchants.entrySet()) {
|
||||
Enchantment enchant = oneEnchant.getKey();
|
||||
if (enchant == null)
|
||||
continue;
|
||||
Enchantment enchant = oneEnchant.getKey();
|
||||
if (enchant == null)
|
||||
continue;
|
||||
|
||||
String enchantName = enchant.getName();
|
||||
if (enchantName == null)
|
||||
continue;
|
||||
String enchantName = enchant.getName();
|
||||
if (enchantName == null)
|
||||
continue;
|
||||
|
||||
Integer level = oneEnchant.getValue();
|
||||
if (level == null)
|
||||
continue;
|
||||
Integer level = oneEnchant.getValue();
|
||||
if (level == null)
|
||||
continue;
|
||||
|
||||
Jobs.action(jPlayer, new EnchantActionInfo(enchantName, level, ActionType.ENCHANT));
|
||||
Jobs.action(jPlayer, new EnchantActionInfo(enchantName, level, ActionType.ENCHANT));
|
||||
}
|
||||
} else
|
||||
Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.REPAIR));
|
||||
@ -1625,7 +1627,7 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
|
||||
if (Jobs.getVersionCheckManager().getVersion().isEqualOrHigher(Version.v1_9_R1)
|
||||
&& !Jobs.getGCManager().payExploringWhenGliding && player.isGliding())
|
||||
&& !Jobs.getGCManager().payExploringWhenGliding && player.isGliding())
|
||||
return;
|
||||
|
||||
ExploreRespond respond = Jobs.getExplore().ChunkRespond(player, event.getNewChunk());
|
||||
|
Loading…
Reference in New Issue
Block a user