Interlude branch.

This commit is contained in:
MobiusDev
2018-03-03 00:51:38 +00:00
parent ae7660220a
commit e013196428
17475 changed files with 1039393 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.log;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
/**
* @author Nos
*/
public abstract class AbstractFormatter extends Formatter
{
private final DateFormat _dateFormat = new SimpleDateFormat("dd/MM HH:mm:ss");
@Override
public String format(LogRecord record)
{
final StringBuilder sb = new StringBuilder(32);
sb.append("[");
sb.append(_dateFormat.format(new Date(record.getMillis())));
sb.append("] ");
sb.append(record.getMessage());
return sb.toString();
}
}

View File

@@ -0,0 +1,32 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.log;
import java.util.logging.Filter;
import java.util.logging.LogRecord;
/**
* @author ProGramMoS, Lets drink to code!
*/
public class AuditFilter implements Filter
{
@Override
public boolean isLoggable(LogRecord record)
{
return record.getLoggerName().equalsIgnoreCase("audit");
}
}

View File

@@ -0,0 +1,51 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.log;
import java.util.logging.LogRecord;
import com.l2jmobius.Config;
/**
* @author zabbix
*/
public class AuditFormatter extends AbstractFormatter
{
@Override
public String format(LogRecord record)
{
final Object[] params = record.getParameters();
final StringBuilder output = new StringBuilder(32 + record.getMessage().length() + (params != null ? 10 * params.length : 0));
output.append(super.format(record));
if (params != null)
{
for (Object p : params)
{
if (p == null)
{
continue;
}
output.append(", ");
output.append(p);
}
}
output.append(Config.EOL);
return output.toString();
}
}

View File

@@ -0,0 +1,31 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.log;
import java.io.IOException;
import java.util.logging.FileHandler;
/**
* @author ProGramMoS, Lets drink to code!
*/
public class AuditLogHandler extends FileHandler
{
public AuditLogHandler() throws IOException, SecurityException
{
super();
}
}

View File

@@ -0,0 +1,29 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.log;
import java.util.logging.Filter;
import java.util.logging.LogRecord;
public class ChatFilter implements Filter
{
@Override
public boolean isLoggable(LogRecord record)
{
return record.getLoggerName() == "chat";
}
}

View File

@@ -0,0 +1,46 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.log;
import java.util.logging.LogRecord;
import com.l2jmobius.Config;
public class ChatLogFormatter extends AbstractFormatter
{
@Override
public String format(LogRecord record)
{
Object[] params = record.getParameters();
final StringBuilder output = new StringBuilder(32 + record.getMessage().length() + (params != null ? 10 * params.length : 0));
output.append(super.format(record));
if (params != null)
{
for (Object p : params)
{
output.append(p);
output.append(" ");
}
}
output.append(record.getMessage());
output.append(Config.EOL);
return output.toString();
}
}

View File

@@ -0,0 +1,28 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.log;
import java.io.IOException;
import java.util.logging.FileHandler;
public class ChatLogHandler extends FileHandler
{
public ChatLogHandler() throws IOException, SecurityException
{
super();
}
}

View File

@@ -0,0 +1,47 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.log;
import java.util.logging.LogRecord;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.Util;
public class ConsoleLogFormatter extends AbstractFormatter
{
@Override
public String format(LogRecord record)
{
final StringBuilder output = new StringBuilder(128);
output.append(super.format(record));
output.append(Config.EOL);
if (record.getThrown() != null)
{
try
{
output.append(Util.getStackTrace(record.getThrown()));
output.append(Config.EOL);
}
catch (Exception ex)
{
}
}
return output.toString();
}
}

View File

@@ -0,0 +1,32 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.log;
import java.util.logging.Filter;
import java.util.logging.LogRecord;
/**
* @author ProGramMoS
*/
public class ErrorFilter implements Filter
{
@Override
public boolean isLoggable(LogRecord record)
{
return record.getThrown() != null;
}
}

View File

@@ -0,0 +1,31 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.log;
import java.io.IOException;
import java.util.logging.FileHandler;
/**
* @author ProGramMoS, scoria dev
*/
public class ErrorLogHandler extends FileHandler
{
public ErrorLogHandler() throws IOException, SecurityException
{
super();
}
}

View File

@@ -0,0 +1,46 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.log;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.StringJoiner;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import com.l2jmobius.Config;
/**
* This class ...
* @version $Revision: 1.1.4.1 $ $Date: 2005/03/27 15:30:08 $
*/
public class FileLogFormatter extends Formatter
{
private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss,SSS");
@Override
public String format(LogRecord record)
{
final StringJoiner sj = new StringJoiner("\t", "", Config.EOL);
sj.add(dateFormat.format(new Date(record.getMillis())));
sj.add(record.getLevel().getName());
sj.add(String.valueOf(record.getThreadID()));
sj.add(record.getLoggerName());
sj.add(record.getMessage());
return sj.toString();
}
}

View File

@@ -0,0 +1,67 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.log;
import java.util.logging.Filter;
import java.util.logging.LogRecord;
import com.l2jmobius.gameserver.model.actor.instance.L2ItemInstance;
/**
* @author Advi
*/
public class ItemFilter implements Filter
{
private String _excludeProcess;
private String _excludeItemType;
// This is example how to exclude consuming of shots and arrows from logging
// private String _excludeProcess = "Consume";
// private String _excludeItemType = "Arrow, Shot";
@Override
public boolean isLoggable(LogRecord record)
{
if (record.getLoggerName() != "item")
{
return false;
}
if (_excludeProcess != null)
{
// if (record.getMessage() == null) return true;
final String[] messageList = record.getMessage().split(":");
if ((messageList.length < 2) || !_excludeProcess.contains(messageList[1]))
{
return true;
}
}
if (_excludeItemType != null)
{
// if (record.getParameters() == null || record.getParameters().length == 0 || !(record.getParameters()[0] instanceof L2ItemInstance))
// return true;
final L2ItemInstance item = (L2ItemInstance) record.getParameters()[0];
if (!_excludeItemType.contains(item.getItemType().toString()))
{
return true;
}
}
return (_excludeProcess == null) && (_excludeItemType == null);
}
}

View File

@@ -0,0 +1,70 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.log;
import java.util.logging.LogRecord;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.model.actor.instance.L2ItemInstance;
/**
* @author Advi
*/
public class ItemLogFormatter extends AbstractFormatter
{
@Override
public String format(LogRecord record)
{
final Object[] params = record.getParameters();
final StringBuilder output = new StringBuilder(32 + record.getMessage().length() + (params != null ? 10 * params.length : 0));
output.append(super.format(record));
for (Object p : record.getParameters())
{
if (p == null)
{
continue;
}
output.append(", ");
if (p instanceof L2ItemInstance)
{
L2ItemInstance item = (L2ItemInstance) p;
output.append("item ");
output.append(item.getObjectId());
output.append(":");
if (item.getEnchantLevel() > 0)
{
output.append("+");
output.append(item.getEnchantLevel());
output.append(" ");
}
output.append(item.getItem().getName());
output.append("(");
output.append(item.getCount());
output.append(")");
}
else
{
output.append(p);
}
}
output.append(Config.EOL);
return output.toString();
}
}

View File

@@ -0,0 +1,31 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.log;
import java.io.IOException;
import java.util.logging.FileHandler;
/**
* @author ProGramMoS
*/
public class ItemLogHandler extends FileHandler
{
public ItemLogHandler() throws IOException, SecurityException
{
super();
}
}