From 072405e40dac48eeaf8f4c4f868d00d94b3893f9 Mon Sep 17 00:00:00 2001
From: frede <65610875+dkfrede@users.noreply.github.com>
Date: Thu, 16 Jun 2022 17:19:09 +0200
Subject: [PATCH 01/10] Expression
---
.../skript/expressions/ExprGetAllArmor.java | 73 +++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
diff --git a/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java b/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
new file mode 100644
index 00000000000..b27b3a48f15
--- /dev/null
+++ b/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
@@ -0,0 +1,73 @@
+/**
+ * This file is part of Skript.
+ *
+ * Skript is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Skript is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Skript. If not, see .
+ *
+ * Copyright Peter Güttinger, SkriptLang team and contributors
+ */
+package ch.njol.skript.expressions;
+import java.util.ArrayList;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.Event;
+import org.bukkit.inventory.ItemStack;
+import org.eclipse.jdt.annotation.Nullable;
+
+import ch.njol.skript.Skript;
+import ch.njol.skript.lang.Expression;
+import ch.njol.skript.lang.ExpressionType;
+import ch.njol.skript.lang.SkriptParser.ParseResult;
+import ch.njol.skript.lang.util.SimpleExpression;
+import ch.njol.util.Kleenean;
+public class ExprGetAllArmor extends SimpleExpression {
+
+ static {
+ Skript.registerExpression(ExprGetAllArmor.class, ItemStack.class, ExpressionType.COMBINED, "%player%'s armor");
+ }
+
+ private Expression player;
+
+ @Override
+ public Class extends ItemStack> getReturnType() {
+ return ItemStack.class;
+ }
+
+ @Override
+ public boolean isSingle() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public boolean init(Expression>[] exprs, int matchedPattern, Kleenean isDelayed, ParseResult parser) {
+ player = (Expression) exprs[0];
+ return true;
+ }
+
+ @Override
+ public String toString(@Nullable Event event, boolean debug) {
+ return "Player: " + player.toString(event, debug);
+ }
+
+ @Override
+ protected @Nullable ItemStack[] get(Event event) {
+ Player p = player.getSingle(event);
+ if (p != null) {
+ org.bukkit.inventory.PlayerInventory inv = p.getInventory();
+ ItemStack[] armor={inv.getHelmet(),inv.getChestplate(),inv.getLeggings(),inv.getBoots()};
+ return armor;
+ }
+ return null;
+ }
+}
From 28e7f45d399ac1817583add8d7f7bef2d5001d6f Mon Sep 17 00:00:00 2001
From: frede <65610875+dkfrede@users.noreply.github.com>
Date: Thu, 16 Jun 2022 18:54:04 +0200
Subject: [PATCH 02/10] Update ExprGetAllArmor.java
---
.../skript/expressions/ExprGetAllArmor.java | 61 ++++++-------------
1 file changed, 19 insertions(+), 42 deletions(-)
diff --git a/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java b/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
index b27b3a48f15..5f4479ae6cf 100644
--- a/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
+++ b/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
@@ -17,57 +17,34 @@
* Copyright Peter Güttinger, SkriptLang team and contributors
*/
package ch.njol.skript.expressions;
-import java.util.ArrayList;
-import org.bukkit.entity.Player;
-import org.bukkit.event.Event;
+import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.ItemStack;
import org.eclipse.jdt.annotation.Nullable;
import ch.njol.skript.Skript;
-import ch.njol.skript.lang.Expression;
+import ch.njol.skript.expressions.base.SimplePropertyExpression;
import ch.njol.skript.lang.ExpressionType;
-import ch.njol.skript.lang.SkriptParser.ParseResult;
-import ch.njol.skript.lang.util.SimpleExpression;
-import ch.njol.util.Kleenean;
-public class ExprGetAllArmor extends SimpleExpression {
+
+public class ExprGetAllArmor extends SimplePropertyExpression {
static {
- Skript.registerExpression(ExprGetAllArmor.class, ItemStack.class, ExpressionType.COMBINED, "%player%'s armor");
- }
-
- private Expression player;
-
- @Override
- public Class extends ItemStack> getReturnType() {
- return ItemStack.class;
- }
-
- @Override
- public boolean isSingle() {
- return true;
+ Skript.registerExpression(ExprGetAllArmor.class, ItemStack[].class, ExpressionType.COMBINED, "%livingentities%'s armor");
}
- @SuppressWarnings("unchecked")
- @Override
- public boolean init(Expression>[] exprs, int matchedPattern, Kleenean isDelayed, ParseResult parser) {
- player = (Expression) exprs[0];
- return true;
- }
+ @Override
+ protected String getPropertyName() {
+ return "get all armor";
+ }
- @Override
- public String toString(@Nullable Event event, boolean debug) {
- return "Player: " + player.toString(event, debug);
- }
-
- @Override
- protected @Nullable ItemStack[] get(Event event) {
- Player p = player.getSingle(event);
- if (p != null) {
- org.bukkit.inventory.PlayerInventory inv = p.getInventory();
- ItemStack[] armor={inv.getHelmet(),inv.getChestplate(),inv.getLeggings(),inv.getBoots()};
- return armor;
- }
- return null;
- }
+ @Override
+ public Class extends ItemStack[]> getReturnType() {
+ return ItemStack[].class;
+ }
+
+ @Override
+ public @Nullable ItemStack[] convert(final LivingEntity f) {
+ ItemStack[] armor=f.getEquipment().getArmorContents();
+ return armor;
+ }
}
From d053300d7e7ac711b2b442d4793755e2df1a3118 Mon Sep 17 00:00:00 2001
From: frede <65610875+dkfrede@users.noreply.github.com>
Date: Thu, 16 Jun 2022 20:14:27 +0200
Subject: [PATCH 03/10] Update
src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
Co-authored-by: Ayham Al Ali
---
src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java b/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
index 5f4479ae6cf..31740b0633c 100644
--- a/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
+++ b/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
@@ -26,7 +26,7 @@
import ch.njol.skript.expressions.base.SimplePropertyExpression;
import ch.njol.skript.lang.ExpressionType;
-public class ExprGetAllArmor extends SimplePropertyExpression {
+public class ExprArmor extends SimplePropertyExpression {
static {
Skript.registerExpression(ExprGetAllArmor.class, ItemStack[].class, ExpressionType.COMBINED, "%livingentities%'s armor");
From 5fa9f67d58fdeefe27452f81ce7a95a53a6a90e1 Mon Sep 17 00:00:00 2001
From: frede <65610875+dkfrede@users.noreply.github.com>
Date: Thu, 16 Jun 2022 20:14:37 +0200
Subject: [PATCH 04/10] Update
src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
Co-authored-by: Ayham Al Ali
---
src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java b/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
index 31740b0633c..8fc413c75bb 100644
--- a/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
+++ b/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
@@ -34,7 +34,7 @@ public class ExprArmor extends SimplePropertyExpression
@Override
protected String getPropertyName() {
- return "get all armor";
+ return "armor";
}
@Override
From 61c5f7bf45c77bd552d10f48a1d461af64fbc195 Mon Sep 17 00:00:00 2001
From: frede <65610875+dkfrede@users.noreply.github.com>
Date: Thu, 16 Jun 2022 20:14:45 +0200
Subject: [PATCH 05/10] Update
src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
Co-authored-by: Ayham Al Ali
---
src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java b/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
index 8fc413c75bb..78620a4fc08 100644
--- a/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
+++ b/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
@@ -38,8 +38,8 @@ protected String getPropertyName() {
}
@Override
- public Class extends ItemStack[]> getReturnType() {
- return ItemStack[].class;
+ public Class extends ItemStack> getReturnType() {
+ return ItemStack.class;
}
@Override
From 7c54996a5ec589cfb821b459ff7582a88e724a0d Mon Sep 17 00:00:00 2001
From: frede <65610875+dkfrede@users.noreply.github.com>
Date: Thu, 16 Jun 2022 20:14:51 +0200
Subject: [PATCH 06/10] Update
src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
Co-authored-by: Ayham Al Ali
---
src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java b/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
index 78620a4fc08..43c5d2dc9c5 100644
--- a/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
+++ b/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
@@ -43,7 +43,8 @@ public Class extends ItemStack> getReturnType() {
}
@Override
- public @Nullable ItemStack[] convert(final LivingEntity f) {
+ @Nullable
+ public ItemStack convert(LivingEntity entity) {
ItemStack[] armor=f.getEquipment().getArmorContents();
return armor;
}
From c6fcef62270e1a21ff80da5941987eec4bdd710f Mon Sep 17 00:00:00 2001
From: frede <65610875+dkfrede@users.noreply.github.com>
Date: Thu, 16 Jun 2022 20:14:57 +0200
Subject: [PATCH 07/10] Update
src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
Co-authored-by: Ayham Al Ali
---
src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java b/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
index 43c5d2dc9c5..acb740fb93f 100644
--- a/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
+++ b/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
@@ -45,7 +45,6 @@ public Class extends ItemStack> getReturnType() {
@Override
@Nullable
public ItemStack convert(LivingEntity entity) {
- ItemStack[] armor=f.getEquipment().getArmorContents();
- return armor;
+ return entity.getEquipment().getArmorContents();
}
}
From e2fbc08bf0a7a490307bc3a7f5f05764cc38910b Mon Sep 17 00:00:00 2001
From: frede <65610875+dkfrede@users.noreply.github.com>
Date: Thu, 16 Jun 2022 20:16:05 +0200
Subject: [PATCH 08/10] Update ExprGetAllArmor.java
---
src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java b/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
index acb740fb93f..f3da4e17ada 100644
--- a/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
+++ b/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
@@ -29,7 +29,7 @@
public class ExprArmor extends SimplePropertyExpression {
static {
- Skript.registerExpression(ExprGetAllArmor.class, ItemStack[].class, ExpressionType.COMBINED, "%livingentities%'s armor");
+ Skript.registerExpression(ExprGetAllArmor.class, ItemStack.class, ExpressionType.COMBINED, "%livingentities%'s armor");
}
@Override
From 5156b46d97f8d68796fda8ca1ae8998d2be4e20b Mon Sep 17 00:00:00 2001
From: frede <65610875+dkfrede@users.noreply.github.com>
Date: Thu, 16 Jun 2022 20:17:11 +0200
Subject: [PATCH 09/10] Update ExprGetAllArmor.java
---
src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java b/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
index f3da4e17ada..23e0a6fe7c1 100644
--- a/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
+++ b/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
@@ -26,6 +26,10 @@
import ch.njol.skript.expressions.base.SimplePropertyExpression;
import ch.njol.skript.lang.ExpressionType;
+@Name("Entities's Armor")
+@Description("Returns a list of all the entities armor.")
+@Examples("player's armor")
+@Since("INSERT VERSION")
public class ExprArmor extends SimplePropertyExpression {
static {
From 0081d21c38fcca67b66865a63c211d7979b6e6c2 Mon Sep 17 00:00:00 2001
From: frede <65610875+dkfrede@users.noreply.github.com>
Date: Thu, 16 Jun 2022 20:17:41 +0200
Subject: [PATCH 10/10] Update ExprGetAllArmor.java
---
src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java b/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
index 23e0a6fe7c1..eaa119d1478 100644
--- a/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
+++ b/src/main/java/ch/njol/skript/expressions/ExprGetAllArmor.java
@@ -27,7 +27,7 @@
import ch.njol.skript.lang.ExpressionType;
@Name("Entities's Armor")
-@Description("Returns a list of all the entities armor.")
+@Description("Returns a list of entities armor.")
@Examples("player's armor")
@Since("INSERT VERSION")
public class ExprArmor extends SimplePropertyExpression {