geforkt von SteamWar/BungeeCore
Merge branch 'master' into ListCommand
Dieser Commit ist enthalten in:
Commit
e68e477868
@ -157,7 +157,7 @@ public class ChatListener extends BasicListener {
|
|||||||
String name = sender.getDisplayName();
|
String name = sender.getDisplayName();
|
||||||
String chatcolor = user.getUserGroup().getChatColorCode();
|
String chatcolor = user.getUserGroup().getChatColorCode();
|
||||||
|
|
||||||
if(user.getUserGroup() != UserGroup.Member)
|
if(user.getUserGroup() != UserGroup.Member || user.getTeam() == 12 || user.getTeam() == 285 || user.getTeam() == 54)
|
||||||
message = ChatColor.translateAlternateColorCodes('&', message);
|
message = ChatColor.translateAlternateColorCodes('&', message);
|
||||||
|
|
||||||
String msg = name + "§7»" + chatcolor + " " + message;
|
String msg = name + "§7»" + chatcolor + " " + message;
|
||||||
|
@ -27,6 +27,7 @@ import de.steamwar.bungeecore.Message;
|
|||||||
import de.steamwar.bungeecore.Servertype;
|
import de.steamwar.bungeecore.Servertype;
|
||||||
import de.steamwar.bungeecore.Subserver;
|
import de.steamwar.bungeecore.Subserver;
|
||||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||||
|
import de.steamwar.bungeecore.sql.Team;
|
||||||
import de.steamwar.bungeecore.sql.UserGroup;
|
import de.steamwar.bungeecore.sql.UserGroup;
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
import net.md_5.bungee.api.config.ServerInfo;
|
import net.md_5.bungee.api.config.ServerInfo;
|
||||||
@ -68,15 +69,11 @@ public class TablistManager extends BasicListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void calculateSize(){
|
private void calculateSize() {
|
||||||
size = -1;
|
size = -1;
|
||||||
for(Map.Entry<String, List<ProxiedPlayer>> server : playerMap.entrySet())
|
size += playerMap.size() * 2 + ProxyServer.getInstance().getPlayers().size();
|
||||||
size += 2 + server.getValue().size();
|
size = (size + 19) / 20;
|
||||||
|
if(size > 5) size = 5;
|
||||||
size = (size+19)/20;
|
|
||||||
|
|
||||||
if(size > 5)
|
|
||||||
size = 5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void updateCustomTablist(){
|
private synchronized void updateCustomTablist(){
|
||||||
@ -173,17 +170,10 @@ public class TablistManager extends BasicListener {
|
|||||||
server = Message.parse("TABLIST_BAU", player);
|
server = Message.parse("TABLIST_BAU", player);
|
||||||
setSlot(i%20, i/20, gray, "§7§l" + server, 1000);
|
setSlot(i%20, i/20, gray, "§7§l" + server, 1000);
|
||||||
i++;
|
i++;
|
||||||
for (ProxiedPlayer p : playerMap.get(server)){
|
i = update(currentServer, playerMap.get(server), i);
|
||||||
boolean sameServer = currentServer == p.getServer().getInfo();
|
|
||||||
setSlot(i % 20, i / 20, BungeeTabListPlusAPI.getIconFromPlayer(p), getTablistName(p, sameServer), (sameServer ? 1 : 500));
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (i < size*20){
|
finish(i);
|
||||||
setSlot(i%20, i/20, darkGray, "", 1000);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}catch(IndexOutOfBoundsException | NullPointerException e){
|
}catch(IndexOutOfBoundsException | NullPointerException e){
|
||||||
//Ignore IndexOutOfBoundsException
|
//Ignore IndexOutOfBoundsException
|
||||||
//Ignore NPE, happens sometimes (only 1s long) when somebody is joining, server switching or disconnecting
|
//Ignore NPE, happens sometimes (only 1s long) when somebody is joining, server switching or disconnecting
|
||||||
@ -200,17 +190,23 @@ public class TablistManager extends BasicListener {
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
spacer = true;
|
spacer = true;
|
||||||
|
Team team = getTeam(player);
|
||||||
List<ProxiedPlayer> players = playerMap.get(server)
|
List<ProxiedPlayer> players = playerMap.get(server)
|
||||||
.stream()
|
.stream()
|
||||||
.filter(p -> p.getServer().getInfo() == currentServer || SteamwarUser.get(p).getUserGroup() != UserGroup.Member)
|
.filter(p -> p.getServer().getInfo() == currentServer || SteamwarUser.get(p).getUserGroup() != UserGroup.Member || (team != null && team == getTeam(p)))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
if (server.equals("Bau")) {
|
|
||||||
Subserver subserver = Subserver.getSubserver(player);
|
Subserver subserver = Subserver.getSubserver(player);
|
||||||
|
if (server.equals("Bau")) {
|
||||||
if (subserver != null && subserver.getType() == Servertype.BAUSERVER) {
|
if (subserver != null && subserver.getType() == Servertype.BAUSERVER) {
|
||||||
players = playerMap.get(server);
|
players = playerMap.get(server);
|
||||||
}
|
}
|
||||||
server = Message.parse("TABLIST_BAU", player);
|
server = Message.parse("TABLIST_BAU", player);
|
||||||
}
|
}
|
||||||
|
if (subserver != null && subserver.getType() == Servertype.ARENA && playerMap.get(server).size() == 1) {
|
||||||
|
players = playerMap.get(server);
|
||||||
|
}
|
||||||
|
|
||||||
int increment = playerMap.get(server).size() - players.size();
|
int increment = playerMap.get(server).size() - players.size();
|
||||||
if (players.isEmpty()) {
|
if (players.isEmpty()) {
|
||||||
server += " §7(" + increment + ")";
|
server += " §7(" + increment + ")";
|
||||||
@ -221,24 +217,38 @@ public class TablistManager extends BasicListener {
|
|||||||
|
|
||||||
setSlot(i%20, i/20, gray, "§7§l" + server, 1000);
|
setSlot(i%20, i/20, gray, "§7§l" + server, 1000);
|
||||||
i++;
|
i++;
|
||||||
for (ProxiedPlayer p : players){
|
i = update(currentServer, players, i);
|
||||||
boolean sameServer = currentServer == p.getServer().getInfo();
|
|
||||||
setSlot(i % 20, i / 20, BungeeTabListPlusAPI.getIconFromPlayer(p), getTablistName(p, sameServer), (sameServer ? 1 : 500));
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (i < size*20){
|
finish(i);
|
||||||
setSlot(i%20, i/20, darkGray, "", 1000);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}catch(IndexOutOfBoundsException | NullPointerException e){
|
}catch(IndexOutOfBoundsException | NullPointerException e){
|
||||||
//Ignore IndexOutOfBoundsException
|
//Ignore IndexOutOfBoundsException
|
||||||
//Ignore NPE, happens sometimes (only 1s long) when somebody is joining, server switching or disconnecting
|
//Ignore NPE, happens sometimes (only 1s long) when somebody is joining, server switching or disconnecting
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getTablistName(ProxiedPlayer p, boolean sameServer) {
|
private int update(ServerInfo currentServer, List<ProxiedPlayer> players, int i) {
|
||||||
|
for (ProxiedPlayer p : players){
|
||||||
|
boolean sameServer = currentServer == p.getServer().getInfo();
|
||||||
|
setSlot(i % 20, i / 20, BungeeTabListPlusAPI.getIconFromPlayer(p), getTablistName(p), (sameServer ? 1 : 500));
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void finish(int i) {
|
||||||
|
while (i < size*20){
|
||||||
|
setSlot(i%20, i/20, darkGray, "", 1000);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Team getTeam(ProxiedPlayer p) {
|
||||||
|
Team team = Team.get(SteamwarUser.get(p).getTeam());
|
||||||
|
return team.getTeamId() <= 0 ? null : team;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getTablistName(ProxiedPlayer p) {
|
||||||
Subserver server = Subserver.getSubserver(p);
|
Subserver server = Subserver.getSubserver(p);
|
||||||
if(server != null){
|
if(server != null){
|
||||||
String tablistName = server.getTablistNames().get(p);
|
String tablistName = server.getTablistNames().get(p);
|
||||||
@ -249,13 +259,14 @@ public class TablistManager extends BasicListener {
|
|||||||
StringBuilder st = new StringBuilder();
|
StringBuilder st = new StringBuilder();
|
||||||
UserGroup group = SteamwarUser.get(p).getUserGroup();
|
UserGroup group = SteamwarUser.get(p).getUserGroup();
|
||||||
|
|
||||||
//else st.append("§7");
|
if (group == UserGroup.Member) {
|
||||||
if(group == UserGroup.Member && sameServer)
|
Team team = getTeam(player);
|
||||||
st.append("§f");
|
if (team != null && team == getTeam(p)) st.append("§f");
|
||||||
else
|
else st.append("§7");
|
||||||
|
} else {
|
||||||
st.append(group.getColorCode());
|
st.append(group.getColorCode());
|
||||||
|
}
|
||||||
|
|
||||||
// if (!sameServer) st.append("§o");
|
|
||||||
return st.append(p.getName()).toString();
|
return st.append(p.getName()).toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren