Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad861b10bb | ||
|
|
db5b7f89f6 | ||
|
|
2c33ce25c0 | ||
|
|
9c3ca429c9 |
@@ -56,7 +56,7 @@ public class PlaceholderManager {
|
|||||||
@NotNull final String identifier) {
|
@NotNull final String identifier) {
|
||||||
Optional<PlaceholderEntry> matching = REGISTERED_PLACEHOLDERS.stream().filter(expansion -> expansion.getIdentifier().equalsIgnoreCase(identifier)).findFirst();
|
Optional<PlaceholderEntry> matching = REGISTERED_PLACEHOLDERS.stream().filter(expansion -> expansion.getIdentifier().equalsIgnoreCase(identifier)).findFirst();
|
||||||
if (matching.isEmpty()) {
|
if (matching.isEmpty()) {
|
||||||
return null;
|
return "";
|
||||||
}
|
}
|
||||||
PlaceholderEntry entry = matching.get();
|
PlaceholderEntry entry = matching.get();
|
||||||
if (player == null && entry.requiresPlayer()) {
|
if (player == null && entry.requiresPlayer()) {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ public class ModifiedTestableItem implements TestableItem {
|
|||||||
/**
|
/**
|
||||||
* The item.
|
* The item.
|
||||||
*/
|
*/
|
||||||
|
@Getter
|
||||||
private final TestableItem handle;
|
private final TestableItem handle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ public class TestableStack implements TestableItem {
|
|||||||
/**
|
/**
|
||||||
* The item.
|
* The item.
|
||||||
*/
|
*/
|
||||||
|
@Getter
|
||||||
private final TestableItem handle;
|
private final TestableItem handle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ class EcoLoadableJSONConfig(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun createFile() {
|
override fun createFile() {
|
||||||
val resourcePath = resourcePath
|
|
||||||
val inputStream = source.getResourceAsStream(resourcePath)!!
|
val inputStream = source.getResourceAsStream(resourcePath)!!
|
||||||
val outFile = File(this.plugin.dataFolder, resourcePath)
|
val outFile = File(this.plugin.dataFolder, resourcePath)
|
||||||
val lastIndex = resourcePath.lastIndexOf('/')
|
val lastIndex = resourcePath.lastIndexOf('/')
|
||||||
@@ -37,11 +36,7 @@ class EcoLoadableJSONConfig(
|
|||||||
}
|
}
|
||||||
if (!outFile.exists()) {
|
if (!outFile.exists()) {
|
||||||
val out: OutputStream = FileOutputStream(outFile)
|
val out: OutputStream = FileOutputStream(outFile)
|
||||||
val buf = ByteArray(1024)
|
inputStream.copyTo(out, 1024)
|
||||||
var len: Int
|
|
||||||
while (inputStream.read(buf).also { len = it } > 0) {
|
|
||||||
out.write(buf, 0, len)
|
|
||||||
}
|
|
||||||
out.close()
|
out.close()
|
||||||
inputStream.close()
|
inputStream.close()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ open class EcoLoadableYamlConfig(
|
|||||||
}
|
}
|
||||||
|
|
||||||
final override fun createFile() {
|
final override fun createFile() {
|
||||||
val resourcePath = resourcePath
|
|
||||||
val inputStream = source.getResourceAsStream(resourcePath)!!
|
val inputStream = source.getResourceAsStream(resourcePath)!!
|
||||||
val outFile = File(this.plugin.dataFolder, resourcePath)
|
val outFile = File(this.plugin.dataFolder, resourcePath)
|
||||||
val lastIndex = resourcePath.lastIndexOf('/')
|
val lastIndex = resourcePath.lastIndexOf('/')
|
||||||
@@ -41,11 +40,7 @@ open class EcoLoadableYamlConfig(
|
|||||||
}
|
}
|
||||||
if (!outFile.exists()) {
|
if (!outFile.exists()) {
|
||||||
val out: OutputStream = FileOutputStream(outFile)
|
val out: OutputStream = FileOutputStream(outFile)
|
||||||
val buf = ByteArray(1024)
|
inputStream.copyTo(out, 1024)
|
||||||
var len: Int
|
|
||||||
while (inputStream.read(buf).also { len = it } > 0) {
|
|
||||||
out.write(buf, 0, len)
|
|
||||||
}
|
|
||||||
out.close()
|
out.close()
|
||||||
inputStream.close()
|
inputStream.close()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.willfp.eco.core.items.Items;
|
|||||||
import com.willfp.eco.core.items.TestableItem;
|
import com.willfp.eco.core.items.TestableItem;
|
||||||
import com.willfp.eco.core.recipe.Recipes;
|
import com.willfp.eco.core.recipe.Recipes;
|
||||||
import com.willfp.eco.core.recipe.parts.MaterialTestableItem;
|
import com.willfp.eco.core.recipe.parts.MaterialTestableItem;
|
||||||
|
import com.willfp.eco.core.recipe.parts.ModifiedTestableItem;
|
||||||
import com.willfp.eco.core.recipe.parts.TestableStack;
|
import com.willfp.eco.core.recipe.parts.TestableStack;
|
||||||
import com.willfp.eco.core.recipe.recipes.CraftingRecipe;
|
import com.willfp.eco.core.recipe.recipes.CraftingRecipe;
|
||||||
import com.willfp.eco.core.recipe.recipes.ShapedCraftingRecipe;
|
import com.willfp.eco.core.recipe.recipes.ShapedCraftingRecipe;
|
||||||
@@ -130,6 +131,22 @@ public class ShapedRecipeListener extends PluginDependent<EcoPlugin> implements
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (part instanceof ModifiedTestableItem modified) {
|
||||||
|
if (modified.getHandle() instanceof MaterialTestableItem) {
|
||||||
|
if (Items.isCustomItem(itemStack)) {
|
||||||
|
event.getInventory().setResult(new ItemStack(Material.AIR));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (part instanceof TestableStack modified) {
|
||||||
|
if (modified.getHandle() instanceof MaterialTestableItem) {
|
||||||
|
if (Items.isCustomItem(itemStack)) {
|
||||||
|
event.getInventory().setResult(new ItemStack(Material.AIR));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,6 +173,24 @@ public class ShapedRecipeListener extends PluginDependent<EcoPlugin> implements
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (part instanceof ModifiedTestableItem modified) {
|
||||||
|
if (modified.getHandle() instanceof MaterialTestableItem) {
|
||||||
|
if (Items.isCustomItem(itemStack)) {
|
||||||
|
event.getInventory().setResult(new ItemStack(Material.AIR));
|
||||||
|
event.setResult(Event.Result.DENY);
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (part instanceof TestableStack modified) {
|
||||||
|
if (modified.getHandle() instanceof MaterialTestableItem) {
|
||||||
|
if (Items.isCustomItem(itemStack)) {
|
||||||
|
event.getInventory().setResult(new ItemStack(Material.AIR));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
version = 6.5.0
|
version = 6.5.2
|
||||||
plugin-name = eco
|
plugin-name = eco
|
||||||
Reference in New Issue
Block a user