Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JobsReborn Event Improvements #431

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.denizenscript.depenizen.bukkit.events.jobs;

import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizen.objects.EntityTag;
import com.denizenscript.denizen.objects.LocationTag;
import com.denizenscript.denizen.objects.PlayerTag;
import com.denizenscript.denizen.utilities.implementation.BukkitScriptEntryData;
import com.denizenscript.denizencore.objects.ObjectTag;
Expand Down Expand Up @@ -28,6 +30,8 @@ public class JobsJobsExpGainScriptEvent extends BukkitScriptEvent implements Lis
// <context.job> Returns a JobsJobTag of the job that the player is gaining exp for.
// <context.experience> Returns an ElementTag(Decimal) of the amount of exp the player will earn.
// <context.action> Returns an ElementTag of the name of the action being paid for, which can be any of the strings from: <@link url https://github.com/Zrips/Jobs/blob/master/src/main/java/com/gamingmesh/jobs/container/ActionType.java>.
// <context.entity> Returns an EntityTag of the entity involved with this event, if applicable.
// <context.block> Returns a LocationTag of the block involved with this event, if applicable.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The meta here looks a little vague - what are the entity/block doing in the context of each event?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jobs itself isn't very clear about this.

The entity is the target of the action, so if i killed a pig and earned money/exp, the entity would be the pig i killed.
It's similar for block, where the location is the block i would have modified.

I'm not really sure how else to word it in the meta.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acting on feedback from discord, I've added an example and slightly changed the wording on the reviewed lines

//
// @Determine
// "EXP:<ElementTag(Decimal)>" to change the amount of Jobs exp this action should provide.
Expand Down Expand Up @@ -72,6 +76,8 @@ public ObjectTag getContext(String name) {
case "job" -> job;
case "experience" -> new ElementTag(event.getExp());
case "action" -> new ElementTag(event.getActionInfo().getType().getName(), true);
case "entity" -> event.getLivingEntity() == null ? null : new EntityTag(event.getLivingEntity()).getDenizenObject();
case "block" -> event.getBlock() == null ? null : new LocationTag(event.getBlock().getLocation());
default -> super.getContext(name);
};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.denizenscript.depenizen.bukkit.events.jobs;

import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizen.objects.EntityTag;
import com.denizenscript.denizen.objects.LocationTag;
import com.denizenscript.denizen.objects.PlayerTag;
import com.denizenscript.denizen.utilities.implementation.BukkitScriptEntryData;
import com.denizenscript.denizencore.objects.ObjectTag;
Expand Down Expand Up @@ -29,6 +31,8 @@ public class JobsJobsPaymentScriptEvent extends BukkitScriptEvent implements Lis
// <context.money> Returns an ElementTag(Decimal) of the amount of money the player will be paid.
// <context.points> Returns an ElementTag(Decimal) of the amount of points the player will be paid.
// <context.action> Returns an ElementTag the name of the action being paid for, which can be any of the strings from: <@link url https://github.com/Zrips/Jobs/blob/master/src/main/java/com/gamingmesh/jobs/container/ActionType.java>.
// <context.entity> Returns an EntityTag of the entity involved with this event, if applicable.
// <context.block> Returns a LocationTag of the block involved with this event, if applicable.
//
// @Determine
// "MONEY:<ElementTag(Decimal)>" to change the amount of money this action should provide.
Expand Down Expand Up @@ -82,6 +86,8 @@ public ObjectTag getContext(String name) {
case "money" -> new ElementTag(event.getAmount());
case "points" -> new ElementTag(event.getPoints());
case "action" -> new ElementTag(event.getActionInfo().getType().getName(), true);
case "entity" -> event.getLivingEntity() == null ? null : new EntityTag(event.getLivingEntity()).getDenizenObject();
case "block" -> event.getBlock() == null ? null : new LocationTag(event.getBlock().getLocation());
default -> super.getContext(name);
};
}
Expand Down