mirror of
https://github.com/songoda/UltimateStacker.git
synced 2024-09-27 14:12:59 +02:00
Performance update.
This commit is contained in:
parent
d229a7a8c6
commit
cd206b16e1
@ -1,6 +1,8 @@
|
|||||||
package com.songoda.ultimatestacker.entity;
|
package com.songoda.ultimatestacker.entity;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public enum Check {
|
public enum Check {
|
||||||
@ -52,6 +54,13 @@ public enum Check {
|
|||||||
this.isEnabledByDefault = isEnabledByDefault;
|
this.isEnabledByDefault = isEnabledByDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<Check> getChecks(List<String> strChecks) {
|
||||||
|
List<Check> checks = new ArrayList<>();
|
||||||
|
for (String checkStr : strChecks)
|
||||||
|
checks.add(getCheck(checkStr));
|
||||||
|
return checks;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isEnabledByDefault() {
|
public boolean isEnabledByDefault() {
|
||||||
return isEnabledByDefault;
|
return isEnabledByDefault;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ public class EntityUtils {
|
|||||||
|
|
||||||
UltimateStacker plugin = UltimateStacker.getInstance();
|
UltimateStacker plugin = UltimateStacker.getInstance();
|
||||||
|
|
||||||
private final List<String> checks = Settings.STACK_CHECKS.getStringList();
|
private final List<Check> checks = Check.getChecks(Settings.STACK_CHECKS.getStringList());
|
||||||
private final boolean stackFlyingDown = Settings.ONLY_STACK_FLYING_DOWN.getBoolean(),
|
private final boolean stackFlyingDown = Settings.ONLY_STACK_FLYING_DOWN.getBoolean(),
|
||||||
keepFire = Settings.KEEP_FIRE.getBoolean(),
|
keepFire = Settings.KEEP_FIRE.getBoolean(),
|
||||||
keepPotion = Settings.KEEP_POTION.getBoolean(),
|
keepPotion = Settings.KEEP_POTION.getBoolean(),
|
||||||
@ -100,8 +100,7 @@ public class EntityUtils {
|
|||||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_12))
|
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_12))
|
||||||
newEntity.setInvulnerable(false);
|
newEntity.setInvulnerable(false);
|
||||||
|
|
||||||
for (String checkStr : checks) {
|
for (Check check : checks) {
|
||||||
Check check = Check.valueOf(checkStr);
|
|
||||||
switch (check) {
|
switch (check) {
|
||||||
case AGE: {
|
case AGE: {
|
||||||
if (!(toClone instanceof Ageable) || ((Ageable) toClone).isAdult()) break;
|
if (!(toClone instanceof Ageable) || ((Ageable) toClone).isAdult()) break;
|
||||||
@ -262,8 +261,7 @@ public class EntityUtils {
|
|||||||
if (stackFlyingDown && Methods.canFly(initialEntity))
|
if (stackFlyingDown && Methods.canFly(initialEntity))
|
||||||
entityList.removeIf(entity -> entity.getLocation().getY() > initialEntity.getLocation().getY());
|
entityList.removeIf(entity -> entity.getLocation().getY() > initialEntity.getLocation().getY());
|
||||||
|
|
||||||
for (String checkStr : checks) {
|
for (Check check : checks) {
|
||||||
Check check = Check.getCheck(checkStr);
|
|
||||||
if (check == null) continue;
|
if (check == null) continue;
|
||||||
switch (check) {
|
switch (check) {
|
||||||
case SPAWN_REASON: {
|
case SPAWN_REASON: {
|
||||||
|
Loading…
Reference in New Issue
Block a user