mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-25 04:05:36 +01:00
Arrays can stream directly.
This commit is contained in:
parent
60eac8e54e
commit
3404fac8f2
@ -141,7 +141,7 @@ public class Flags {
|
|||||||
* @return List of all the flags in this class
|
* @return List of all the flags in this class
|
||||||
*/
|
*/
|
||||||
public static List<Flag> values() {
|
public static List<Flag> values() {
|
||||||
return Arrays.asList(Flags.class.getFields()).stream().map(field -> {
|
return Arrays.stream(Flags.class.getFields()).map(field -> {
|
||||||
try {
|
try {
|
||||||
return (Flag)field.get(null);
|
return (Flag)field.get(null);
|
||||||
} catch (IllegalArgumentException | IllegalAccessException e) {
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
@ -21,7 +21,7 @@ public class Placeholders {
|
|||||||
* @return List of all the flags in this class
|
* @return List of all the flags in this class
|
||||||
*/
|
*/
|
||||||
public static List<Placeholder> values() {
|
public static List<Placeholder> values() {
|
||||||
return Arrays.asList(Placeholders.class.getFields()).stream().map(field -> {
|
return Arrays.stream(Placeholders.class.getFields()).map(field -> {
|
||||||
try {
|
try {
|
||||||
return (Placeholder)field.get(null);
|
return (Placeholder)field.get(null);
|
||||||
} catch (IllegalArgumentException | IllegalAccessException e) {
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
@ -54,7 +54,7 @@ public class AddonsManager {
|
|||||||
if (!f.exists()) {
|
if (!f.exists()) {
|
||||||
f.mkdirs();
|
f.mkdirs();
|
||||||
}
|
}
|
||||||
Arrays.asList(f.listFiles()).stream().filter(x -> !x.isDirectory() && x.getName().endsWith(".jar")).forEach(t -> {
|
Arrays.stream(f.listFiles()).filter(x -> !x.isDirectory() && x.getName().endsWith(".jar")).forEach(t -> {
|
||||||
plugin.log("Loading " + t.getName());
|
plugin.log("Loading " + t.getName());
|
||||||
try {
|
try {
|
||||||
loadAddon(t);
|
loadAddon(t);
|
||||||
|
@ -316,7 +316,7 @@ public class IslandsManagerTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testBadBlocks() {
|
public void testBadBlocks() {
|
||||||
// Fences
|
// Fences
|
||||||
Arrays.asList(Material.values()).stream().filter(m -> m.toString().contains("FENCE")).forEach(m -> {
|
Arrays.stream(Material.values()).filter(m -> m.toString().contains("FENCE")).forEach(m -> {
|
||||||
when(ground.getType()).thenReturn(m);
|
when(ground.getType()).thenReturn(m);
|
||||||
assertFalse("Fence :" + m.toString(), manager.isSafeLocation(location));
|
assertFalse("Fence :" + m.toString(), manager.isSafeLocation(location));
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user