1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-02-12 18:31:32 +01:00

Better item recognition

This commit is contained in:
Zrips 2018-08-01 16:55:30 +03:00
parent 374cca2b22
commit 6354efab91
11 changed files with 889 additions and 430 deletions

View File

@ -12,12 +12,8 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.8.0_161"/>
<attributes> <classpathentry exported="true" kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>

View File

@ -1,8 +1,13 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.compiler.source=1.8

File diff suppressed because it is too large Load Diff

View File

@ -96,6 +96,7 @@ import com.gamingmesh.jobs.listeners.PistonProtectionListener;
import com.gamingmesh.jobs.selection.SelectionManager; import com.gamingmesh.jobs.selection.SelectionManager;
import com.gamingmesh.jobs.stuff.ActionBar; import com.gamingmesh.jobs.stuff.ActionBar;
import com.gamingmesh.jobs.stuff.CMIScoreboardManager; import com.gamingmesh.jobs.stuff.CMIScoreboardManager;
import com.gamingmesh.jobs.stuff.Debug;
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling; import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling;
import com.gamingmesh.jobs.stuff.Loging; import com.gamingmesh.jobs.stuff.Loging;
import com.gamingmesh.jobs.stuff.RawMessage; import com.gamingmesh.jobs.stuff.RawMessage;
@ -755,7 +756,7 @@ public class Jobs extends JavaPlugin {
versionCheckManager = new VersionChecker(this); versionCheckManager = new VersionChecker(this);
ItemManager.load(); ItemManager.load();
version = versionCheckManager.getVersion().getShortVersion(); version = versionCheckManager.getVersion().getShortVersion();
// itemManager = new ItemManager(this); // itemManager = new ItemManager(this);

View File

@ -62,7 +62,6 @@ public class MythicMobs4 implements MythicMobInterface {
@Override @Override
public String getDisplayName(String id) { public String getDisplayName(String id) {
Debug.D(id);
MythicMob mm = MMAPI.getMythicMob(id); MythicMob mm = MMAPI.getMythicMob(id);
if (mm != null) if (mm != null)
return mm.getDisplayName(); return mm.getDisplayName();

View File

@ -21,8 +21,10 @@ package com.gamingmesh.jobs.actions;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.container.ActionInfo; import com.gamingmesh.jobs.container.ActionInfo;
import com.gamingmesh.jobs.container.ActionType; import com.gamingmesh.jobs.container.ActionType;
import com.gamingmesh.jobs.stuff.VersionChecker.Version;
public class BlockActionInfo extends MaterialActionInfo implements ActionInfo { public class BlockActionInfo extends MaterialActionInfo implements ActionInfo {
public BlockActionInfo(Block block, ActionType type) { public BlockActionInfo(Block block, ActionType type) {
@ -30,6 +32,8 @@ public class BlockActionInfo extends MaterialActionInfo implements ActionInfo {
} }
private static byte getData(Block block) { private static byte getData(Block block) {
if (Jobs.getVersionCheckManager().getVersion().isEqualOrHigher(Version.v1_13_R1))
return 0;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
byte data = block.getData(); byte data = block.getData();
if (block.getType() == Material.COCOA) if (block.getType() == Material.COCOA)

View File

@ -456,7 +456,7 @@ public class editjobs implements Cmd {
player.sendMessage(ChatColor.GOLD + "Automatically changing block to GLOWING_REDSTONE_ORE. Please update your configuration."); player.sendMessage(ChatColor.GOLD + "Automatically changing block to GLOWING_REDSTONE_ORE. Please update your configuration.");
player.sendMessage(ChatColor.GOLD + "In vanilla minecraft, REDSTONE_ORE changes to GLOWING_REDSTONE_ORE when interacted with."); player.sendMessage(ChatColor.GOLD + "In vanilla minecraft, REDSTONE_ORE changes to GLOWING_REDSTONE_ORE when interacted with.");
player.sendMessage(ChatColor.GOLD + "In the future, Jobs using REDSTONE_ORE instead of GLOWING_REDSTONE_ORE may fail to work correctly."); player.sendMessage(ChatColor.GOLD + "In the future, Jobs using REDSTONE_ORE instead of GLOWING_REDSTONE_ORE may fail to work correctly.");
material = CMIMaterial.GLOWING_REDSTONE_ORE; material = CMIMaterial.REDSTONE_ORE;
} }
type = material.toString(); type = material.toString();

View File

@ -250,7 +250,7 @@ public class ConfigManager {
Jobs.getPluginLogger().warning("Automatically changing block to GLOWING_REDSTONE_ORE. Please update your configuration."); Jobs.getPluginLogger().warning("Automatically changing block to GLOWING_REDSTONE_ORE. Please update your configuration.");
Jobs.getPluginLogger().warning("In vanilla minecraft, REDSTONE_ORE changes to GLOWING_REDSTONE_ORE when interacted with."); Jobs.getPluginLogger().warning("In vanilla minecraft, REDSTONE_ORE changes to GLOWING_REDSTONE_ORE when interacted with.");
Jobs.getPluginLogger().warning("In the future, Jobs using REDSTONE_ORE instead of GLOWING_REDSTONE_ORE may fail to work correctly."); Jobs.getPluginLogger().warning("In the future, Jobs using REDSTONE_ORE instead of GLOWING_REDSTONE_ORE may fail to work correctly.");
material = CMIMaterial.GLOWING_REDSTONE_ORE; material = CMIMaterial.REDSTONE_ORE;
} }
// END HACK // END HACK
@ -832,7 +832,7 @@ public class ConfigManager {
myKey = myKey.split("-")[0]; myKey = myKey.split("-")[0];
} }
CMIMaterial material = CMIMaterial.get(myKey); CMIMaterial material = CMIMaterial.get(myKey + (subType));
if (material == null) if (material == null)
material = CMIMaterial.get(myKey.replace(" ", "_").toUpperCase()); material = CMIMaterial.get(myKey.replace(" ", "_").toUpperCase());
@ -901,7 +901,7 @@ public class ConfigManager {
Jobs.getPluginLogger().warning("Automatically changing block to GLOWING_REDSTONE_ORE. Please update your configuration."); Jobs.getPluginLogger().warning("Automatically changing block to GLOWING_REDSTONE_ORE. Please update your configuration.");
Jobs.getPluginLogger().warning("In vanilla minecraft, REDSTONE_ORE changes to GLOWING_REDSTONE_ORE when interacted with."); Jobs.getPluginLogger().warning("In vanilla minecraft, REDSTONE_ORE changes to GLOWING_REDSTONE_ORE when interacted with.");
Jobs.getPluginLogger().warning("In the future, Jobs using REDSTONE_ORE instead of GLOWING_REDSTONE_ORE may fail to work correctly."); Jobs.getPluginLogger().warning("In the future, Jobs using REDSTONE_ORE instead of GLOWING_REDSTONE_ORE may fail to work correctly.");
material = CMIMaterial.GLOWING_REDSTONE_ORE; material = CMIMaterial.REDSTONE_ORE;
} }
// END HACK // END HACK
@ -1023,6 +1023,36 @@ public class ConfigManager {
} }
} }
switch (actionType) {
case BREED:
case CUSTOMKILL:
case BREW:
case EXPLORE:
case FISH:
case KILL:
case MILK:
case MMKILL:
case SHEAR:
case TAME:
break;
case TNTBREAK:
case SMELT:
case REPAIR:
case PLACE:
case ENCHANT:
case DYE:
case EAT:
case CRAFT:
case BREAK:
if (Jobs.getVersionCheckManager().getVersion().isEqualOrHigher(Version.v1_13_R1)){
subType = "";
meta = "";
}
break;
default:
break;
}
jobInfo.add(new JobInfo(actionType, id, meta, type + subType, income, incomeEquation, experience, expEquation, pointsEquation, points, fromlevel, jobInfo.add(new JobInfo(actionType, id, meta, type + subType, income, incomeEquation, experience, expEquation, pointsEquation, points, fromlevel,
untilLevel, section.getCurrentPath(), softIncomeLimit, softExpLimit, softPointsLimit)); untilLevel, section.getCurrentPath(), softIncomeLimit, softExpLimit, softPointsLimit));
} }

View File

@ -33,6 +33,7 @@ import org.bukkit.inventory.ItemStack;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.resources.jfep.Parser; import com.gamingmesh.jobs.resources.jfep.Parser;
import com.gamingmesh.jobs.stuff.ChatColor; import com.gamingmesh.jobs.stuff.ChatColor;
import com.gamingmesh.jobs.stuff.Debug;
public class Job { public class Job {
// job info // job info
@ -225,6 +226,7 @@ public class Job {
} }
public JobInfo getJobInfo(ActionInfo action, int level) { public JobInfo getJobInfo(ActionInfo action, int level) {
for (JobInfo info : getJobInfo(action.getType())) { for (JobInfo info : getJobInfo(action.getType())) {
if (info.getName().equalsIgnoreCase(action.getName()) || info.getName().equalsIgnoreCase(action.getNameWithSub())) { if (info.getName().equalsIgnoreCase(action.getName()) || info.getName().equalsIgnoreCase(action.getNameWithSub())) {
if (!info.isInLevelRange(level)) if (!info.isInLevelRange(level))

View File

@ -95,6 +95,7 @@ import com.gamingmesh.jobs.container.ExploreRespond;
import com.gamingmesh.jobs.container.FastPayment; import com.gamingmesh.jobs.container.FastPayment;
import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobProgression;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.stuff.Debug;
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling; import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling;
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling.ownershipFeedback; import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling.ownershipFeedback;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -248,7 +249,7 @@ public class JobsPaymentListener implements Listener {
Player player = jPlayer.getPlayer(); Player player = jPlayer.getPlayer();
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName())) if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
return; return;
ItemStack contents = event.getContents().getIngredient(); ItemStack contents = event.getContents().getIngredient();
@ -257,7 +258,7 @@ public class JobsPaymentListener implements Listener {
Jobs.action(jPlayer, new ItemActionInfo(contents, ActionType.BREW)); Jobs.action(jPlayer, new ItemActionInfo(contents, ActionType.BREW));
} }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event) { public void onBlockBreak(BlockBreakEvent event) {
//disabling plugin in world //disabling plugin in world
@ -278,7 +279,7 @@ public class JobsPaymentListener implements Listener {
return; return;
// check if in creative // check if in creative
if (player.getGameMode() == GameMode.CREATIVE && !Jobs.getGCManager().payInCreative()) if (player.getGameMode() == GameMode.CREATIVE && !Jobs.getGCManager().payInCreative())
return; return;
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName())) if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
@ -1334,7 +1335,7 @@ public class JobsPaymentListener implements Listener {
if (event.isCancelled()) if (event.isCancelled())
return; return;
if (CMIMaterial.get(block).equals(CMIMaterial.FURNACE) || CMIMaterial.get(block).equals(CMIMaterial.BURNING_FURNACE)) { if (CMIMaterial.get(block).equals(CMIMaterial.FURNACE) || CMIMaterial.get(block).equals(CMIMaterial.LEGACY_BURNING_FURNACE)) {
ownershipFeedback done = FurnaceBrewingHandling.registerFurnaces(event.getPlayer(), block); ownershipFeedback done = FurnaceBrewingHandling.registerFurnaces(event.getPlayer(), block);
if (done.equals(ownershipFeedback.tooMany)) { if (done.equals(ownershipFeedback.tooMany)) {

View File

@ -247,7 +247,7 @@ public class FurnaceBrewingHandling {
public static ownershipFeedback registerFurnaces(Player player, Block block) { public static ownershipFeedback registerFurnaces(Player player, Block block) {
if (!CMIMaterial.get(block).equals(CMIMaterial.FURNACE) && !CMIMaterial.get(block).equals(CMIMaterial.BURNING_FURNACE)) { if (!CMIMaterial.get(block).equals(CMIMaterial.FURNACE) && !CMIMaterial.get(block).equals(CMIMaterial.LEGACY_BURNING_FURNACE)) {
return ownershipFeedback.invalid; return ownershipFeedback.invalid;
} }
@ -345,7 +345,7 @@ public class FurnaceBrewingHandling {
if (block == null) if (block == null)
continue; continue;
if (!CMIMaterial.get(block).equals(CMIMaterial.FURNACE) && !CMIMaterial.get(block).equals(CMIMaterial.BURNING_FURNACE)) { if (!CMIMaterial.get(block).equals(CMIMaterial.FURNACE) && !CMIMaterial.get(block).equals(CMIMaterial.LEGACY_BURNING_FURNACE)) {
continue; continue;
} }
block.removeMetadata(JobsPaymentListener.furnaceOwnerMetadata, Jobs.getInstance()); block.removeMetadata(JobsPaymentListener.furnaceOwnerMetadata, Jobs.getInstance());