Skip to content

Commit

Permalink
Avoid legacy materials in aliases and expritems (#7087)
Browse files Browse the repository at this point in the history
  • Loading branch information
sovdeeth authored Oct 1, 2024
1 parent 03b4ebb commit cb6d995
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
6 changes: 3 additions & 3 deletions src/main/java/ch/njol/skript/aliases/Aliases.java
Original file line number Diff line number Diff line change
Expand Up @@ -395,17 +395,17 @@ public static void load() {
}

/**
* Temporarily create an alias for a material which may not have an alias yet.
* Temporarily create an alias for materials which do not have aliases yet.
*/
private static void loadMissingAliases() {
if (!Skript.methodExists(Material.class, "getKey"))
return;
for (Material material : Material.values()) {
if (!provider.hasAliasForMaterial(material)) {
if (!material.isLegacy() && !provider.hasAliasForMaterial(material)) {
NamespacedKey key = material.getKey();
String name = key.getKey().replace("_", " ");
parser.loadAlias(name + "¦s", key.toString());
Skript.debug(ChatColor.YELLOW + "Creating temporary alias for: " + key.toString());
Skript.debug(ChatColor.YELLOW + "Creating temporary alias for: " + key);
}
}
}
Expand Down
20 changes: 1 addition & 19 deletions src/main/java/ch/njol/skript/expressions/ExprItems.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
/**
* 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 <http://www.gnu.org/licenses/>.
*
* Copyright Peter Güttinger, SkriptLang team and contributors
*/
package ch.njol.skript.expressions;

import ch.njol.skript.Skript;
Expand Down Expand Up @@ -54,7 +36,7 @@
public class ExprItems extends SimpleExpression<ItemType> {

private static final ItemType[] ALL_BLOCKS = Arrays.stream(Material.values())
.filter(Material::isBlock)
.filter(material -> !material.isLegacy() && material.isBlock())
.map(ItemType::new)
.toArray(ItemType[]::new);

Expand Down

0 comments on commit cb6d995

Please sign in to comment.