-
-
Notifications
You must be signed in to change notification settings - Fork 382
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
Spawners Incoming #7477
Spawners Incoming #7477
Conversation
# Conflicts: # src/main/java/ch/njol/skript/Skript.java # src/main/java/ch/njol/skript/classes/data/SkriptClasses.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just the first batch.
I would also like to note, imo, for all occurrences when inside of the get
method of expressions. If the condition was unmet, instead of returning new Object[0]
with Object
being what the type needs to be, it should return null
.
TESTS
import org.bukkit.event.Event; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class ExprWeight extends SimplePropertyExpression<Object, Integer> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs
continue; | ||
|
||
if (!weighted.supportsWeightChange()) { | ||
error("The weight of this object cannot be changed."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only problem I have with this, is that it doesn't say what object that was provided cannot be changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It provides the line and file, but sure that is fair
|
||
@Override | ||
protected String getPropertyName() { | ||
return "the weight"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return "the weight"; | |
return "weight"; |
|
||
@Override | ||
protected String getPropertyName() { | ||
return "spawner" + (isNegated() ? " is not " : " is ") + "activated"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return "spawner" + (isNegated() ? " is not " : " is ") + "activated"; | |
return "an activated spawner"; |
The isNegated part is handled within PropertyCondition.
if (light > 15) { | ||
warning("The sky light spawn level cannot be greater than 15, thus setting it to a value larger than 15 will do nothing."); | ||
return; | ||
} else if (light < 0) { | ||
warning("The sky light spawn level cannot be less than 0, thus setting it to a value less than 0 will do nothing."); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Smae here
|
||
@Override | ||
protected String getPropertyName() { | ||
return type.name().toLowerCase() + " trial spawner config"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return type.name().toLowerCase() + " trial spawner config"; | |
return type.name().toLowerCase(Locale.ENGLISH) + " trial spawner config"; |
|
||
@Override | ||
protected String getPropertyName() { | ||
return (additional ? "additional " : "base ") + "spawns"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to match property registered
if (additional) { | ||
builder.append("additional"); | ||
} else { | ||
builder.append("base"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Match patterns
if (players) | ||
values.addAll(spawner.getTrackedPlayers()); | ||
else | ||
values.addAll(spawner.getTrackedEntities()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (players) | |
values.addAll(spawner.getTrackedPlayers()); | |
else | |
values.addAll(spawner.getTrackedEntities()); | |
if (players) { | |
values.addAll(spawner.getTrackedPlayers()); | |
} else { | |
values.addAll(spawner.getTrackedEntities()); | |
} |
src/main/resources/lang/default.lang
Outdated
@@ -2555,6 +2555,16 @@ input keys: | |||
sneak: sneak key, sneaking key | |||
sprint: sprint key, sprinting key | |||
|
|||
//todo: remove after merge of equippable pr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a java comment💀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh god i was brainwashed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
epic start
src/main/java/org/skriptlang/skript/bukkit/spawner/SpawnerModule.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/spawner/SpawnerModule.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/spawner/elements/conditions/CondIsActivated.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/spawner/elements/conditions/CondIsActivated.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/spawner/elements/conditions/CondIsTracking.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/spawner/util/SpawnerUtils.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/spawner/util/SpawnerUtils.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/spawner/util/SpawnerUtils.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/spawner/util/SpawnerUtils.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few things.
Pardon me if something of these have been mention already.
I was half way thru this when Effy submitted his!
return; | ||
|
||
Classes.registerClass(new ClassInfo<>(TrialSpawnerConfig.class, "trialspawnerconfig") | ||
.user("(trial ?)?spawner ?config(urations?)?") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is "trial" optional? To prevent possible conflicts in the future and/or with other addons, this should be required.
); | ||
|
||
Classes.registerClass(new ClassInfo<>(SpawnerEntry.class, "spawnerentry") | ||
.user("spawner ?entry") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should probably be entr(y|ies)
maybe?
@Examples("set the spawned item of target block to diamond") | ||
@Since("INSERT VERSION") | ||
@RequiredPlugins("MC 1.21+") | ||
public class EffSpawnedItem extends Effect { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason this is an effect and not an expression?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no way to get the spawned item, only setting it is possible afaik
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 additional things
- This is Paper exclusive
- The
setSpawnedItem
just makes it the entity type be a dropped item, with the item being what was provided insetSpaawnedItem
.supplier(EffTrialSpawnerTrack::new) | ||
.priority(SyntaxInfo.COMBINED) | ||
.addPatterns( | ||
"make [the] %blocks/trialspawnerconfigs% (1:start|stop) tracking %entities%", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm cofused, why two patterns? a Player is an entity, in the execute you could check if the entity is an instance of a player
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if i am correct, tracking the player with the start tracking entity method works differently than player. I am not exactly sure how it works but I'll clean up the docs
"", | ||
"Base spawners are trial spawner configurations, spawner minecarts and creature spawners." | ||
}) | ||
@Examples({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should include some examples of your changers
|
||
@Override | ||
public String toString(@Nullable Event event, boolean debug) { | ||
return "possible trial spawner rewards of" + getExpr().toString(event, debug); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesnt seem to be remotely related to the pattern?!?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alot of things were changed during the making of this and I completely forgot about the toString methods.
.supplier(ExprTrackedEntities::new) | ||
.priority(PropertyExpression.DEFAULT_PRIORITY) | ||
.addPatterns( | ||
"[the] tracked (1:player[s]|entit(y|ies)) (from|of) %blocks/trialspawnerconfigs%", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should include spawner
here, or something to destinguish this.
Spigot/Paper have tracked player/entity stuff, so we shouldnt create possible conflicts
...main/java/org/skriptlang/skript/bukkit/spawner/elements/expressions/ExprSpawnerLocation.java
Show resolved
Hide resolved
...main/java/org/skriptlang/skript/bukkit/spawner/elements/expressions/ExprSpawnerLocation.java
Outdated
Show resolved
Hide resolved
} else { | ||
builder.append("normal "); | ||
} | ||
builder.append("trial spawner configuration of trial spawner at ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this worries me how insanely long this is going to be.
After all my comments I wanted to add one final comment. This is my opinion (.... again... opinion). I personally (again, my opinion) feel that this is better suited for its own addon. |
I guess I agree with this... Any other opinions? |
Description
This PR aims to add advanced support for interacting with base spawners, spawners, trial spawner configurations and trial spawners.
PR #7009 was abandoned, thus this PR was made.
Everything here is only supported for versions newer than 1.21+, making this PR a breaking change because of ExprSpawnerType
TODO: tests, remove the enum class info for equipment slots after the merge of #7194
Target Minecraft Versions: 1.21+
Requirements: 1.21+
Related Issues: #6856, #5846