Посмотрите видео ниже, чтобы узнать, как установить наш сайт в виде веб-приложения на главном экране.
Примечание: Эта функция может быть недоступна в некоторых браузерах.
ну несовсемм оно так работы хватает.Прикольно спасибо , но что бы ставить на лайв проект еще пилить и пилить там косяков моря и критичных столько жедля школьных проектов самое то пилить.
### Eclipse Workspace Patch 1.0
#P aCis_gameserver
diff --git java/net/sf/l2j/gameserver/handler/AbstractHandler.java
index db5728c..0c09598 100644
--- java/net/sf/l2j/gameserver/handler/AbstractHandler.java
+++ java/net/sf/l2j/gameserver/handler/AbstractHandler.java
@@ -1,91 +1,95 @@
package net.sf.l2j.gameserver.handler;
import java.io.File;
import java.lang.reflect.Modifier;
import java.net.JarURLConnection;
import java.net.URL;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import net.sf.l2j.commons.logging.CLogger;
public abstract class AbstractHandler<K, H>
{
private static final CLogger LOGGER = new CLogger(AbstractHandler.class.getName());
protected final Map<K, H> _entries = new HashMap<>();
protected abstract void registerHandler(H handler);
- protected AbstractHandler(Class<H> handlerInterface, String className)
- {
- final String packagePath = "net/sf/l2j/gameserver/handler/" + className;
-
- try
- {
- final Enumeration<URL> resources = Thread.currentThread().getContextClassLoader().getResources(packagePath);
-- while (resources.hasMoreElements())
- {
- final URL resource = resources.nextElement();
-
- // Handle debug process.
- if (resource.getProtocol().equals("file"))
- {
- final File directory = new File(resource.getFile());
-- if (!directory.exists())
- continue;
-
- final String packageName = packagePath.replace("/", ".");
-
- for (String file : directory.list())
- {
- if (!file.endsWith(".class"))
- continue;
-
- final Class<?> clazz = Class.forName(packageName + "." + file.substring(0, file.length() - 6));
- if (!handlerInterface.isAssignableFrom(clazz) || clazz.isInterface() || Modifier.isAbstract(clazz.getModifiers()))
- continue;
-
- registerHandler(handlerInterface.cast(clazz.getDeclaredConstructor().newInstance()));
- }
- }
- // Handle regular JAR process.
- else if (resource.getProtocol().equals("jar"))
- {
- final JarURLConnection conn = (JarURLConnection) resource.openConnection();
- try (JarFile jarFile = conn.getJarFile())
- {
- final Enumeration<JarEntry> entries = jarFile.entries();
- while (entries.hasMoreElements())
- {
- final JarEntry entry = entries.nextElement();
- final String entryName = entry.getName();
-
- if (!entryName.startsWith(packagePath) || !entryName.endsWith(".class"))
- continue;
-
- final Class<?> clazz = Class.forName(entryName.replace('/', '.').replace(".class", ""));
- if (!handlerInterface.isAssignableFrom(clazz) || clazz.isInterface() || Modifier.isAbstract(clazz.getModifiers()))
- continue;
-
- registerHandler(handlerInterface.cast(clazz.getDeclaredConstructor().newInstance()));
- }
- }
- }
- }
- }
- catch (Exception e)
- {
- LOGGER.warn("Failed to load classes from package {}", e, packagePath);
- }
- }
+ protected AbstractHandler(Class<H> handlerInterface, String className)
+ {
+ final String packagePath = "net/sf/l2j/gameserver/handler/" + className;
+
+ try
+ {
+ final Enumeration<URL> resources = Thread.currentThread().getContextClassLoader().getResources(packagePath);
+ while (resources.hasMoreElements())
+ {
+ final URL resource = resources.nextElement();
+
+ // Handle debug process.
+ // Suporte a modo debug no Eclipse
+ if (resource.getProtocol().equals("file"))
+ {
+ File directory = new File(resource.toURI());
+
+ if (!directory.exists() || !directory.isDirectory())
+ continue;
+
+ String packageName = packagePath.replace("/", ".");
+
+ for (File file : directory.listFiles())
+ {
+ if (!file.getName().endsWith(".class"))
+ continue;
+
+ String simpleClassName = file.getName().substring(0, file.getName().length() - 6);
+ Class<?> clazz = Class.forName(packageName + "." + simpleClassName);
+
+ if (!handlerInterface.isAssignableFrom(clazz) || clazz.isInterface() || Modifier.isAbstract(clazz.getModifiers()))
+ continue;
+
+ registerHandler(handlerInterface.cast(clazz.getDeclaredConstructor().newInstance()));
+ }
+ }
+ // Handle regular JAR process.
+ else if (resource.getProtocol().equals("jar"))
+ {
+ final JarURLConnection conn = (JarURLConnection) resource.openConnection();
+ try (JarFile jarFile = conn.getJarFile())
+ {
+ final Enumeration<JarEntry> entries = jarFile.entries();
+ while (entries.hasMoreElements())
+ {
+ final JarEntry entry = entries.nextElement();
+ final String entryName = entry.getName();
+
+ if (!entryName.startsWith(packagePath) || !entryName.endsWith(".class"))
+ continue;
+
+ final Class<?> clazz = Class.forName(entryName.replace('/', '.').replace(".class", ""));
+ if (!handlerInterface.isAssignableFrom(clazz) || clazz.isInterface() || Modifier.isAbstract(clazz.getModifiers()))
+ continue;
+
+ registerHandler(handlerInterface.cast(clazz.getDeclaredConstructor().newInstance()));
+ }
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ LOGGER.warn("Failed to load classes from package {}", e, packagePath);
+ }
+ }
public int size()
{
return _entries.size();
}
public H getHandler(Object key)
diff --git java/net/sf/l2j/gameserver/taskmanager/AiTaskManager.java
index dbd8c7b..34c7300 100644
--- java/net/sf/l2j/gameserver/taskmanager/AiTaskManager.java
+++ java/net/sf/l2j/gameserver/taskmanager/AiTaskManager.java
@@ -14,81 +14,87 @@
import net.sf.l2j.gameserver.model.actor.instance.Monster;
import net.sf.l2j.gameserver.model.actor.instance.RaidBoss;
/**
* Handle all {@link Npc} AI tasks.
*/
public final class AiTaskManager implements Runnable
{
private final Set<Npc> _npcs = ConcurrentHashMap.newKeySet();
private static final int RETURN_HOME_RAIDBOSS_RADIUS = Config.RETURN_HOME_RAIDBOSS_RADIUS;
private static final int RETURN_HOME_MONSTER_RADIUS = Config.RETURN_HOME_MONSTER_RADIUS;
private static final Set<Integer> EXCLUDED_RAIDBOSS_IDS = Set.of(29095);
private static final Set<Integer> EXCLUDED_MONSTER_IDS = Set.of(29016, 29008, 29004);
protected AiTaskManager()
{
// Run task each second.
ThreadPool.scheduleAtFixedRate(this, 1000, 1000);
// Run task every 10 seconds.
ThreadPool.scheduleAtFixedRate(this::animationTask, 10000, 10000);
}
@Override
public final void run()
{
_npcs.forEach(npc -> processNpc(npc));
}
private void processNpc(Npc npc)
{
npc.getAI().runAI();
if (npc instanceof GrandBoss)
return;
else if (npc instanceof RaidBoss raidBoss)
monsterReturn(raidBoss, Config.RETURN_HOME_RAIDBOSS, RETURN_HOME_RAIDBOSS_RADIUS, EXCLUDED_RAIDBOSS_IDS);
else if (npc instanceof Monster monster)
- monsterReturn(monster, Config.RETURN_HOME_MONSTER, RETURN_HOME_MONSTER_RADIUS, EXCLUDED_MONSTER_IDS);
+ {
+ // Evitar retornar raid related (inclui minions do boss)
+ if (monster.isRaidRelated())
+ return;
+ monsterReturn(monster, Config.RETURN_HOME_MONSTER, RETURN_HOME_MONSTER_RADIUS, EXCLUDED_MONSTER_IDS);
+ }
}
private void monsterReturn(Monster monster, boolean returnHome, int radius, Set<Integer> excludedNpcIds)
{
if (!returnHome || isNpcIdExcluded(monster.getNpcId(), excludedNpcIds))
return;
if (!monster.isIn3DRadius(monster.getSpawnLocation(), radius))
{
System.out.println("Returning monster: " + monster.getNpcId());
monster.teleportTo(monster.getSpawnLocation(), 0);
monster.removeAllAttackDesire();
monster.getStatus().setHpMp(monster.getStatus().getMaxHp(), monster.getStatus().getMaxMp());
teleportMinions(monster);
}
}
private boolean isNpcIdExcluded(int npcId, Set<Integer> excludedNpcIds)
{
return excludedNpcIds.contains(npcId);
}
private void teleportMinions(Monster monster)
{
monster.getMinions().forEach(minion ->
{
if (!minion.isDead())
{
minion.teleportToMaster();
minion.removeAllAttackDesire();
minion.getStatus().setHpMp(minion.getStatus().getMaxHp(), minion.getStatus().getMaxMp());
}
});
}
protected final void animationTask()
{
_npcs.stream().filter(npc -> npc instanceof Folk).forEach(folk ->
{
int moveAroundSocial = folk.getTemplate().getAiParams().getInteger("MoveAroundSocial", 0);
++++DeadAngel добавил(а) новый ресурс:
RuAcis 3.8 [Исходники] - Исходный код
Узнать больше об этом ресурсе...
ПосмотретьDeadAngel добавил(а) новый ресурс:
RuAcis 3.8 [Исходники] - Исходный код
Узнать больше об этом ресурсе...