Merge branch 'master' of https://github.com/gnembon/fabric-carpet
This commit is contained in:
commit
569f4d502d
4 files changed
+18
-4
No files matched your search
@@ -76,9 +76,14 @@ public class FileModule extends Module
|
|||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
try
|
// Copy of NbtIo.read(File) because that's now client-side only
|
||||||
|
if (!file.exists())
|
||||||
{
|
{
|
||||||
return NbtIo.read(file);
|
return null;
|
||||||
|
}
|
||||||
|
try (DataInputStream in = new DataInputStream(new FileInputStream(file)))
|
||||||
|
{
|
||||||
|
return NbtIo.read(in);
|
||||||
}
|
}
|
||||||
catch (IOException ioException)
|
catch (IOException ioException)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class DataStructures {
|
|||||||
if (lv.size() == 1)
|
if (lv.size() == 1)
|
||||||
{
|
{
|
||||||
hwat = lv.get(0);
|
hwat = lv.get(0);
|
||||||
delimiter = StringValue.EMPTY;
|
delimiter = null;
|
||||||
}
|
}
|
||||||
else if (lv.size() == 2)
|
else if (lv.size() == 2)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -350,6 +350,11 @@ public class ListValue extends AbstractListValue implements ContainerValueInterf
|
|||||||
@Override
|
@Override
|
||||||
public Value split(Value delimiter) {
|
public Value split(Value delimiter) {
|
||||||
ListValue result = new ListValue();
|
ListValue result = new ListValue();
|
||||||
|
if (delimiter == null)
|
||||||
|
{
|
||||||
|
this.forEach(item -> result.items.add(of(item)));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
int startIndex = 0;
|
int startIndex = 0;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (Value val : this.items)
|
for (Value val : this.items)
|
||||||
|
|||||||
@@ -193,7 +193,11 @@ public abstract class Value implements Comparable<Value>, Cloneable
|
|||||||
|
|
||||||
public Value split(Value delimiter)
|
public Value split(Value delimiter)
|
||||||
{
|
{
|
||||||
try
|
if (delimiter == null)
|
||||||
|
{
|
||||||
|
delimiter = StringValue.EMPTY;
|
||||||
|
}
|
||||||
|
try
|
||||||
{
|
{
|
||||||
return ListValue.wrap(Arrays.stream(getString().split(delimiter.getString())).map(StringValue::new).collect(Collectors.toList()));
|
return ListValue.wrap(Arrays.stream(getString().split(delimiter.getString())).map(StringValue::new).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user