Skip to content

Commit

Permalink
Merge branch 'dev/patch' into fix/null-enum-lang-names
Browse files Browse the repository at this point in the history
  • Loading branch information
APickledWalrus authored Feb 1, 2024
2 parents bdc94e1 + 758e3f9 commit 08e987f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/ch/njol/skript/classes/data/JavaClasses.java
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ public boolean mustSyncDeserialization() {
.description("Text is simply text, i.e. a sequence of characters, which can optionally contain expressions which will be replaced with a meaningful representation " +
"(e.g. %player% will be replaced with the player's name).",
"Because scripts are also text, you have to put text into double quotes to tell Skript which part of the line is an effect/expression and which part is the text.",
"Please read the article on <a href='./strings/'>Texts and Variable Names</a> to learn more.")
"Please read the article on <a href='./text.html'>Texts and Variable Names</a> to learn more.")
.usage("simple: \"...\"",
"quotes: \"...\"\"...\"",
"expressions: \"...%expression%...\"",
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/ch/njol/skript/entity/SimpleEntityData.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.bukkit.entity.Bat;
import org.bukkit.entity.Blaze;
import org.bukkit.entity.BlockDisplay;
import org.bukkit.entity.Breeze;
import org.bukkit.entity.Camel;
import org.bukkit.entity.CaveSpider;
import org.bukkit.entity.ChestedHorse;
Expand Down Expand Up @@ -130,6 +131,7 @@
import org.bukkit.entity.WanderingTrader;
import org.bukkit.entity.Warden;
import org.bukkit.entity.WaterMob;
import org.bukkit.entity.WindCharge;
import org.bukkit.entity.Witch;
import org.bukkit.entity.Wither;
import org.bukkit.entity.WitherSkeleton;
Expand Down Expand Up @@ -310,6 +312,11 @@ private static void addSuperEntity(String codeName, Class<? extends Entity> enti
addSuperEntity("display", Display.class);
}

if (Skript.isRunningMinecraft(1, 20, 3)) {
addSimpleEntity("breeze", Breeze.class);
addSimpleEntity("wind charge", WindCharge.class);
}

// Register zombie after Husk and Drowned to make sure both work
addSimpleEntity("zombie", Zombie.class);
// Register squid after glow squid to make sure both work
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/ch/njol/skript/expressions/ExprArmorSlot.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ public class ExprArmorSlot extends PropertyExpression<LivingEntity, Slot> {
@Nullable
private EquipSlot slot;
private boolean explicitSlot;
private boolean isArmor;

@Override
@SuppressWarnings("unchecked")
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, ParseResult parseResult) {
slot = parseResult.hasTag("armour") ? null : EquipSlot.valueOf(parseResult.tags.get(0).toUpperCase(Locale.ENGLISH));
isArmor = parseResult.hasTag("armour");
slot = isArmor ? null : EquipSlot.valueOf(parseResult.tags.get(0).toUpperCase(Locale.ENGLISH));
explicitSlot = parseResult.hasTag("slot"); // User explicitly asked for SLOT, not item
setExpr((Expression<? extends LivingEntity>) exprs[0]);
return true;
Expand Down Expand Up @@ -92,6 +94,11 @@ protected Slot[] get(Event event, LivingEntity[] source) {
});
}

@Override
public boolean isSingle() {
return !isArmor && super.isSingle();
}

@Override
public Class<Slot> getReturnType() {
return Slot.class;
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/lang/default.lang
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,13 @@ entities:
text display:
name: text display¦s
pattern: text display(|1¦s)
# 1.20.3 Entities
breeze:
name: breeze¦s
pattern: breeze(|1¦s)
wind charge:
name: wind charge¦s
pattern: wind charge(|1¦s)

# -- Heal Reasons --
heal reasons:
Expand Down

0 comments on commit 08e987f

Please sign in to comment.