Sync with L2jServer HighFive Mar 25th 2015.

This commit is contained in:
MobiusDev
2015-03-25 06:48:51 +00:00
parent e0c66b1412
commit 82606870c0
194 changed files with 2619 additions and 2869 deletions

View File

@ -22,9 +22,9 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -48,8 +48,8 @@ public class Forum
public static final int CLANMEMBERONLY = 2;
public static final int OWNERONLY = 3;
private final List<Forum> _children;
private final Map<Integer, Topic> _topic;
private final List<Forum> _children = new ArrayList<>();
private final Map<Integer, Topic> _topic = new ConcurrentHashMap<>();
private final int _forumId;
private String _forumName;
private int _forumType;
@ -68,8 +68,6 @@ public class Forum
{
_forumId = Forumid;
_fParent = FParent;
_children = new ArrayList<>();
_topic = new HashMap<>();
}
/**
@ -88,8 +86,6 @@ public class Forum
_forumPerm = perm;
_fParent = parent;
_ownerID = OwnerID;
_children = new ArrayList<>();
_topic = new HashMap<>();
parent._children.add(this);
ForumsBBSManager.getInstance().addForum(this);
_loaded = true;
@ -151,7 +147,7 @@ public class Forum
{
while (rs.next())
{
Forum f = new Forum(rs.getInt("forum_id"), this);
final Forum f = new Forum(rs.getInt("forum_id"), this);
_children.add(f);
ForumsBBSManager.getInstance().addForum(f);
}
@ -208,14 +204,7 @@ public class Forum
public Forum getChildByName(String name)
{
vload();
for (Forum f : _children)
{
if (f.getName().equals(name))
{
return f;
}
}
return null;
return _children.stream().filter(f -> f.getName().equals(name)).findFirst().orElse(null);
}
/**

View File

@ -47,7 +47,7 @@ public class Post
public String postTxt;
}
private final List<CPost> _post;
private final List<CPost> _post = new ArrayList<>();
/**
* @param _PostOwner
@ -59,8 +59,7 @@ public class Post
*/
public Post(String _PostOwner, int _PostOwnerID, long date, int tid, int _PostForumID, String txt)
{
_post = new ArrayList<>();
CPost cp = new CPost();
final CPost cp = new CPost();
cp.postId = 0;
cp.postOwner = _PostOwner;
cp.postOwnerId = _PostOwnerID;
@ -73,6 +72,11 @@ public class Post
}
public Post(Topic t)
{
load(t);
}
public void insertindb(CPost cp)
{
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
@ -93,23 +97,9 @@ public class Post
}
}
public Post(Topic t)
{
_post = new ArrayList<>();
load(t);
}
public CPost getCPost(int id)
{
int i = 0;
for (CPost cp : _post)
{
if (i++ == id)
{
return cp;
}
}
return null;
return _post.get(id);
}
public void deleteme(Topic t)
@ -142,7 +132,7 @@ public class Post
{
while (rs.next())
{
CPost cp = new CPost();
final CPost cp = new CPost();
cp.postId = rs.getInt("post_id");
cp.postOwner = rs.getString("post_owner_name");
cp.postOwnerId = rs.getInt("post_ownerid");