Code improvements.
This commit is contained in:
@@ -34,8 +34,7 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
|
||||
@Override
|
||||
public void registerHandler(IAdminCommandHandler handler)
|
||||
{
|
||||
final String[] ids = handler.getAdminCommandList();
|
||||
for (String id : ids)
|
||||
for (String id : handler.getAdminCommandList())
|
||||
{
|
||||
_datatable.put(id, handler);
|
||||
}
|
||||
@@ -44,8 +43,7 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
|
||||
@Override
|
||||
public synchronized void removeHandler(IAdminCommandHandler handler)
|
||||
{
|
||||
final String[] ids = handler.getAdminCommandList();
|
||||
for (String id : ids)
|
||||
for (String id : handler.getAdminCommandList())
|
||||
{
|
||||
_datatable.remove(id);
|
||||
}
|
||||
@@ -54,12 +52,7 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
|
||||
@Override
|
||||
public IAdminCommandHandler getHandler(String adminCommand)
|
||||
{
|
||||
String command = adminCommand;
|
||||
if (adminCommand.contains(" "))
|
||||
{
|
||||
command = adminCommand.substring(0, adminCommand.indexOf(" "));
|
||||
}
|
||||
return _datatable.get(command);
|
||||
return _datatable.get((adminCommand.contains(" ") ? adminCommand.substring(0, adminCommand.indexOf(" ")) : adminCommand));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -63,8 +63,7 @@ public final class EffectHandler implements IHandler<Class<? extends AbstractEff
|
||||
{
|
||||
try
|
||||
{
|
||||
final File file = new File(L2ScriptEngineManager.SCRIPT_FOLDER, "handlers/EffectMasterHandler.java");
|
||||
L2ScriptEngineManager.getInstance().executeScript(file);
|
||||
L2ScriptEngineManager.getInstance().executeScript((new File(L2ScriptEngineManager.SCRIPT_FOLDER, "handlers/EffectMasterHandler.java")));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -34,8 +34,7 @@ public class UserCommandHandler implements IHandler<IUserCommandHandler, Integer
|
||||
@Override
|
||||
public void registerHandler(IUserCommandHandler handler)
|
||||
{
|
||||
final int[] ids = handler.getUserCommandList();
|
||||
for (int id : ids)
|
||||
for (int id : handler.getUserCommandList())
|
||||
{
|
||||
_datatable.put(id, handler);
|
||||
}
|
||||
@@ -44,8 +43,7 @@ public class UserCommandHandler implements IHandler<IUserCommandHandler, Integer
|
||||
@Override
|
||||
public synchronized void removeHandler(IUserCommandHandler handler)
|
||||
{
|
||||
final int[] ids = handler.getUserCommandList();
|
||||
for (int id : ids)
|
||||
for (int id : handler.getUserCommandList())
|
||||
{
|
||||
_datatable.remove(id);
|
||||
}
|
||||
|
||||
@@ -34,8 +34,7 @@ public class VoicedCommandHandler implements IHandler<IVoicedCommandHandler, Str
|
||||
@Override
|
||||
public void registerHandler(IVoicedCommandHandler handler)
|
||||
{
|
||||
final String[] ids = handler.getVoicedCommandList();
|
||||
for (String id : ids)
|
||||
for (String id : handler.getVoicedCommandList())
|
||||
{
|
||||
_datatable.put(id, handler);
|
||||
}
|
||||
@@ -44,8 +43,7 @@ public class VoicedCommandHandler implements IHandler<IVoicedCommandHandler, Str
|
||||
@Override
|
||||
public synchronized void removeHandler(IVoicedCommandHandler handler)
|
||||
{
|
||||
final String[] ids = handler.getVoicedCommandList();
|
||||
for (String id : ids)
|
||||
for (String id : handler.getVoicedCommandList())
|
||||
{
|
||||
_datatable.remove(id);
|
||||
}
|
||||
@@ -54,12 +52,7 @@ public class VoicedCommandHandler implements IHandler<IVoicedCommandHandler, Str
|
||||
@Override
|
||||
public IVoicedCommandHandler getHandler(String voicedCommand)
|
||||
{
|
||||
String command = voicedCommand;
|
||||
if (voicedCommand.contains(" "))
|
||||
{
|
||||
command = voicedCommand.substring(0, voicedCommand.indexOf(" "));
|
||||
}
|
||||
return _datatable.get(command);
|
||||
return _datatable.get((voicedCommand.contains(" ") ? voicedCommand.substring(0, voicedCommand.indexOf(" ")) : voicedCommand));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user