CodeCrafter47 / BungeeTabListPlus

GNU General Public License v3.0
146 stars 70 forks source link

Players disappear from list after resumed from unstable Redis connection #201

Open k-jiang opened 7 years ago

k-jiang commented 7 years ago

BungeeTabListPlus 2.7.3 RedisBungee 0.3.10 under BungeeCord

I use RedisBungee and have multiple BungeeCord instances set up in different location. Sometimes some of my BungeeCord have unstable Redis connection e.g. temporary packet losses due to long distance connection. When this happened, players are disappear from the Tab List other than players from this particular instance. There is no way to fix this unless I restart the BungeeCord. However, /glist showall could list all players correctly after Redis resume to normal and {playerset:global size} shows a correct amount of overall player counts.

17:36:43 [SEVERE] [RedisBungee] Unable to get connection from pool - did your Redis server go away?
com.imaginarycode.minecraft.redisbungee.internal.jedis.exceptions.JedisConnectionException: java.net.SocketException: Connection reset
    at com.imaginarycode.minecraft.redisbungee.internal.jedisutil.RedisInputStream.ensureFill(RedisInputStream.java:201)
    at com.imaginarycode.minecraft.redisbungee.internal.jedisutil.RedisInputStream.readByte(RedisInputStream.java:40)
    at com.imaginarycode.minecraft.redisbungee.internal.jedis.Protocol.process(Protocol.java:141)
    at com.imaginarycode.minecraft.redisbungee.internal.jedis.Protocol.read(Protocol.java:205)
    at com.imaginarycode.minecraft.redisbungee.internal.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:297)
    at com.imaginarycode.minecraft.redisbungee.internal.jedis.Connection.getBinaryMultiBulkReply(Connection.java:233)
    at com.imaginarycode.minecraft.redisbungee.internal.jedis.Connection.getMultiBulkReply(Connection.java:226)
    at com.imaginarycode.minecraft.redisbungee.internal.jedis.Jedis.sunion(Jedis.java:1230)
    at com.imaginarycode.minecraft.redisbungee.RedisBungee.getPlayers(RedisBungee.java:185)
    at com.imaginarycode.minecraft.redisbungee.RedisBungeeAPI.getPlayersOnline(RedisBungeeAPI.java:72)
    at codecrafter47.bungeetablistplus.managers.RedisPlayerManager.updatePlayers(RedisPlayerManager.java:164)
    at net.md_5.bungee.scheduler.BungeeTask.run(BungeeTask.java:63)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(SocketInputStream.java:210)
    at java.net.SocketInputStream.read(SocketInputStream.java:141)
    at java.net.SocketInputStream.read(SocketInputStream.java:127)
    at com.imaginarycode.minecraft.redisbungee.internal.jedisutil.RedisInputStream.ensureFill(RedisInputStream.java:195)
    ... 14 more

My config.yml:

# This is the configuration file of BungeeTabListPlus
# See https://github.com/CodeCrafter47/BungeeTabListPlus/wiki for additional information

# time in seconds after which the tabList will be resend to all players
# set this to -1 to disable scheduled update of the tabList
# This option will be removed soon. Don't use it anymore.
tablistUpdateInterval: 10.0

# whether tabList should be resend if a player joins or leaves the server
# This option will be removed soon. Don't use it anymore.
updateOnPlayerJoinLeave: true

# whether tablist should be resend if a player switches the server
# This option will be removed soon. Don't use it anymore.
updateOnServerChange: true

# You can limit the number of characters per slot here
# Color codes do not count as a character; -1 means unlimited
# This option will be removed soon. Don't use it anymore.
charLimit: -1

# Decide from where BungeeTabListPlus takes information like permissions,
# prefix, suffix and group.
# Possible values:
# AUTO        - take best source
# BUKKIT      - take information from Bukkit/Vault
# BUNGEEPERMS - take information from BungeePerms
# BUNGEE      - take group from bungee, prefix from config.yml, permissions from bungee
# This option will be removed soon. Don't use it anymore.
permissionSource: AUTO

# whether to show players in spectator mode
# This option will be removed soon. Don't use it anymore.
showPlayersInGamemode3: true

# if enabled the plugin checks for new versions automatically.
# Use /BTLP to see whether a new version is available
# this does NOT automatically install an update
checkForUpdates: false

# this notifies admins (everyone with the permission `bungeetablistplus.admin`) if an update is available
notifyAdminsIfUpdateAvailable: false

# If this is set to true and the plugin encounters an issue a bug report is sent automatically
# Bug reports do not contain any sensitive or identifying information
# Bug reports contain the plugin name, plugin version and the error message that also appears in the server log
automaticallySendBugReports: false

# This option will be removed soon. Don't use it anymore.
# See https://github.com/CodeCrafter47/BungeeTabListPlus/wiki/Updating#server-alias
serverAlias:
  survival: '&2生存'
  games: '&b竞技'
  skyland: '&b空岛'
  rpg: '&7冒险'
  creative: '&3创造'

# This option will be removed soon. Don't use it anymore.
# See https://github.com/CodeCrafter47/BungeeTabListPlus/wiki/Updating#world-alias
worldAlias:
  factions:world_end: The End
  factions:world: Overworld
  factions:world_nether: Nether

# This option will be removed soon. Don't use it anymore.
# See https://github.com/CodeCrafter47/BungeeTabListPlus/wiki/Updating#server-prefix
serverPrefixes:
  Minigames: '&8(&bM&8)'
  SkyBlock: '&8(&dS&8) '

# This option will be removed soon. Don't use it anymore.
# See https://github.com/CodeCrafter47/BungeeTabListPlus/wiki/Updating#prefixes-in-configyml
prefixes:
  admin: '&c[A] '
  default: ''

# Interval (in seconds) at which all servers of your network get pinged to check whether they are online
# If you intend to use the {onlineState:SERVER} variable set this to 2 or any value you like
# setting this to -1 disables this feature
pingDelay: 60

# This option will be removed soon. Don't use it anymore.
# See https://github.com/CodeCrafter47/BungeeTabListPlus/wiki/Updating#the-onlinestate-placeholder
online-text: ''

# This option will be removed soon. Don't use it anymore.
# See https://github.com/CodeCrafter47/BungeeTabListPlus/wiki/Updating#the-onlinestate-placeholder
offline-text: '&7(&c&l!&7) '

# those fakeplayers will randomly appear on the tablist. If you don't put any names there then no fakeplayers will appear
fakePlayers: []

# servers which you wish to show their own tabList (The one provided by bukkit)
excludeServers: []

# servers which you wish to hide from the global tabList
# Note that this is different from excludeServers above: this hides all players on the hidden servers from appearing
# on the tablist, whereas excluded servers' players are still on the BungeeTabListPlus tablist, but they do not see
# the global tab list
hiddenServers: []

# players which are permanently hidden from the tab list
# you can either put your username or your uuid (with dashes) here
# don't use this. you have absolutely no reason to hide from anyone. on your own server.
hiddenPlayers: []

# Time zone to use for the {time} variable
# Can be full name like "America/Los_Angeles"
# or custom id like "GMT+8"
time-zone: America/Shanghai

# Custom placeholders
customPlaceholders: {}

My tabList/default.yml looks like this:

# This is the default configuration file of BungeeTabListPlus.
#
# Since the configuration of the plugin is quite complex you
# might want to have a look at the wiki from time to time.
# 
# Wiki: https://github.com/CodeCrafter47/BungeeTabListPlus/wiki
#  Placeholders: https://github.com/CodeCrafter47/BungeeTabListPlus/wiki/Placeholders
#  Examples: https://github.com/CodeCrafter47/BungeeTabListPlus/wiki/Examples
#

# It is possible to have multiple tab list configuration files.
# BungeeTabListPlus will parse all .yml files it finds in the tabLists directory.
# Which tab list a player sees depends on the showTo and priority options.

# All player see this tab list
showTo: "all"

# Examples of alternative options for showTo:
# showTo: ' ${viewer server} == "Factions" '
# showTo: ' ${viewer server} == "Factions" or ${viewer server} == "Survival" '
# showTo: ' ${viewer vault_primary_group} == "Admin" '

# If after evaluating the showTo option of all tab list configs multiple tab lists
# are visible to a player, he will bw shown the one with the highest priority:
priority: 0

# Tab list header and footer:
showHeaderFooter: true

header:
- '&d&l- 欢迎加入随便MC云服! -'
- '&d&l- 欢迎加入随便MC云服! -'
- '&d&l- 欢迎加入随便MC云服! -'
- '&d&l- 欢迎加入随便MC云服! -'
- '&d&l- 欢迎加入随便MC云服! -'
- '&d&l\ 欢迎加入随便MC云服! /'
- '&d&l| 欢迎加入随便MC云服! |'
- '&d&l/ 欢迎加入随便MC云服! \'
- '&d&l- 欢迎加入随便MC云服! -'
- '&d&l- 欢迎加入随便MC云服! -'
- '&d&l- 欢迎加入随便MC云服! -'
- '&d&l- 欢迎加入随便MC云服! -'
- '&d&l- 欢迎加入随便MC云服! -'
- '&d&l/ 欢迎加入随便MC云服! \'
- '&d&l| 欢迎加入随便MC云服! |'
- '&d&l\ 欢迎加入随便MC云服! /'

headerAnimationUpdateInterval: 1

footer:
- '&7您的角色UUID: ${viewer uuid}'

footerAnimationUpdateInterval: 5.0

# Custom placeholders are a powerful mechanism to add more dynamic content
# to the tab list.
customPlaceholders:
  # Defines the ${afk_tag} placeholder which is used to add "|away"
  # to the players name if he is afk.
  afk_tag:
    !conditional
    condition: ${player essentials_afk}
    true: '&7|&oafk'
    false: ''
  # Defines the ${viewer_colored_ping0} placeholder which displays the ping in green
  # if it is below 50ms, otherwise in yellow.
  viewer_colored_ping0:
    !conditional
    condition: "${viewer ping} < 50"
    true: "&a${viewer ping}"
    false: "&e${viewer ping}"
  # Defines ${the viewer_colored_ping} placeholder which displays the ping in red
  # if it is above 150ms, otherwise it is replaced with the ${viewer_colored_ping0}
  # placeholder ( < 50 -> green, > 50 -> yellow).
  # That results in the following color scheme:
  # 0 - 49   -> green
  # 50 - 149 -> yellow
  # 150+     -> red
  viewer_colored_ping:
    !conditional
    condition: "${viewer ping} < 150"
    true: ${viewer_colored_ping0}
    false: "&c${viewer ping}"
  server_alias:
    !switch
    parameters: 1
    expression: "${%0}"
    replacements:
      "survival": "&2生存"
      "creative": "&3创造"
      "skyland": "&b空岛"
      "rpg": "&7冒险"
    defaultReplacement: "${%0}"
  online_state:
    !conditional
    parameters: 1
    condition: ${%0 online}
    true: "" #"&a在线"
    false: "&c(关闭)"

# Player sets are required to display players and player counts on the tab list.
# To display a player count use ${playerset:<name> size}, example: ${playerset:global size}.
playerSets:
  # The global player set contains all players
  global:
    filter: "true"
 # # Some more examples. Be careful to get the number of spaces right when using them.
 # # Player set containing all players on a specific server:
  # survival:
    # filter: |-
      # ${server_alias player server} == "survival"
  # creative:
    # filter: |-
      # ${server_alias player server} == "creative"
  # skyland:
    # filter: |-
      # ${server_alias player server} == "skyland"
  # rpg:
    # filter: |-
      # ${server_alias player server} == "rpg"
  # # Player set containing all players on the same server as the player viewing the tab list:
# currentserver:
#   filter: |-
#     ${player server} == ${viewer server}
# # Player set containing all players on a specific server and world:
# survival_nether:
#   filter: |-
#     ${player server} == "survival"
#     and ${player world} == "world_nether"
# # Player set containing all admins:
# admins:
#   filter: |-
#     ${player vault_primary_group} == "admin"
#     or ${player vault_primary_group} == "owner"

# We want the tab list to have a fixed size of 60 slots.
# If you want a dynamic size you need to set type to DYNAMIC_SIZE
# and you don't need any of the options below it. Have a look at
# the example in the wiki to see which options you need instead:
# https://github.com/CodeCrafter47/BungeeTabListPlus/wiki/Examples#global-tab-list-dynamic-size
type: FIXED_SIZE
size: 80 # 60 slots -> 3 columns, 20 rows

# The defaultIcon and defaultPing will be used for all slots for which no other value is
# explicitely set.
defaultIcon: colors/transparent_gray.png
defaultPing: 1000

# Here the content of the tab list is configured:
components:
# Three info slots at the top
- {text: "  --========"} # 1st row, 1st column
# Show ping in different colors depending on how good/ bad it is
- {text: "&f您的账号: &6${viewer name}", icon: "${viewer skin}", ping: "${viewer ping}"} # 1st row, 2nd column
- {text: "&f当前服务器: ${server_alias viewer server}", icon: "default/server.png", ping: 0} # 1st row, 3rd column
- {text: "    ========--  "} # 1st row, 3rd column
#- {text: "&cServer: &6${viewer server}", icon: "default/server.png", ping: 0} # 1st row, 2nd column
#- {text: "&cRank: &6${viewer vault_primary_group}", icon: "default/rank.png", ping: 0} # 1st row, 2nd column
#- {text: "&cPing: ${viewer_colored_ping}ms", icon: "default/ping.png", ping: 0} # 1st row, 3rd column
# A row of empty slots below
- {text: ""} # 2nd row, 1st column
- {} # 2nd row, 2nd column; Since icon and ping are the default they don't need to be specified explicitely.
- {} # 2nd row, 3rd column; Since the text is empty it doesn't need to be specified either
- {}
# The players by server component adds players to the tab list grouped by server
- !players_by_server
  # The global player set is configured above
  playerSet: global
  # The server header is shown for each server above the players on that server.
  # We use it to display the server name and the player count.
  serverHeader:
  - {text: "&9&l> ${online_state server}${server_alias server}&7&o (${server_player_count}):", icon: "colors/yellow.png", ping: 0}
  # The server separator is shown between two consecutive servers. 
  # Here it use used to separate the servers with an empty row of slots, showing two more variants to display an empty slot.
  serverSeparator:
  - {}
  - ""
  -
  # Whether empty servers should show up too
  includeEmptyServers: true
  # Format of the player slot. Add prefixes as you like
  playerComponent: "${player name}"
  # If there isn't enough space for all players the morePlayersComponent is displayed. We use to to display the number of players which couldn't be displayed on the tab list.
  morePlayersComponent: {text: "&7... 还有 &e${other_count} &7个玩家"}
# A spacer creates as many empty slots as possible.
- !spacer {}
# Because the spacer has eaten up all the remaining free slots, the nine slots below are guaranteed to be at the bottom of the tab list.
# Let's start with another empty row
- "" # 18th row, 1st column
- "" # 18th row, 2nd column
- "" # 18th row, 3rd column
- "" # 18th row, 4th column
- "&8================" # 19th row, 4th column
- "&8================" # 18th row, 4th column
- "&8================" # 18th row, 4th column
- "&8================" # 18th row, 4th column
- {text: "&2时间: &a${time H:mm:ss}", icon: "default/clock.png"} # 20th row, 1st column
- {text: "&2总在线: &a${playerset:global size}", icon: "default/players.png"} # 20th row, 2nd column
- {text: "&2客户端版本: &a${viewer client_version}", icon: "default/server.png"} # 20th row, 3rd column
- {text: "&2节点延迟(毫秒): &a${viewer ping}", icon: "default/server.png", ping: "${viewer ping}"} # 20th row, 4th column

This does not happen before I have upgraded from version 2.6.2. Everything work just fine by then even though I have unstable Redis connection.

If you need any more info please state below, thanks!

k-jiang commented 7 years ago

Just an update: No luck with RedisBungee 0.4 :( DK if it is related: https://github.com/minecrafter/RedisBungee/issues/52