Removed stream usage from RangeSortByHp affect scope.

This commit is contained in:
MobiusDevelopment
2023-01-08 13:50:02 +00:00
parent f8cd0bf1e0
commit 022c9d5028
26 changed files with 468 additions and 182 deletions

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override

View File

@@ -16,6 +16,8 @@
*/ */
package handlers.targethandlers.affectscope; package handlers.targethandlers.affectscope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -33,7 +35,7 @@ import org.l2jmobius.gameserver.model.skill.targets.AffectScope;
/** /**
* Range sorted by lowest to highest hp percent affect scope implementation. * Range sorted by lowest to highest hp percent affect scope implementation.
* @author Nik * @author Nik, Mobius
*/ */
public class RangeSortByHp implements IAffectScopeHandler public class RangeSortByHp implements IAffectScopeHandler
{ {
@@ -82,12 +84,21 @@ public class RangeSortByHp implements IAffectScopeHandler
} }
// Sort from lowest hp to highest hp. // Sort from lowest hp to highest hp.
//@formatter:off final List<Creature> sortedList = new ArrayList<>(result);
result.stream() Collections.sort(sortedList, Comparator.comparingInt(Creature::getCurrentHpPercent));
.sorted(Comparator.comparingInt(Creature::getCurrentHpPercent))
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE) int count = 0;
.forEach(action); final int limit = (affectLimit > 0) ? affectLimit : Integer.MAX_VALUE;
//@formatter:on for (Creature c : sortedList)
{
if (count >= limit)
{
break;
}
count++;
action.accept(c);
}
} }
@Override @Override