• 欢迎来到Minecraft插件百科!
  • 对百科编辑一脸懵逼?帮助:快速入门带您快速熟悉百科编辑!
  • 因近日遭受攻击,百科现已限制编辑,有意编辑请加入插件百科企鹅群:223812289

LeaderHeads/网页插件:修订间差异

来自Minecraft插件百科
跳转到导航 跳转到搜索
无编辑摘要
第1行: 第1行:
{{待完善}}
LeaderHeads 网页插件可以让你在网页上看到玩家的数据记录. 这一插件拥有大量特性且高度可自定义.
LeaderHeads 网页插件可以让你在网页上看到玩家的数据记录. 这一插件拥有大量特性且高度可自定义.
===== 网页插件配置 =====
===== 网页插件配置 =====
第12行: 第13行:




# The description of the page as it appears in a search engine description.
# 搜索引擎显示的描述.
description: "Leaderboards"
description: "Leaderboards"


# The title of the page as it appears in the tab of your browser.
# 浏览器网页显示的标题.
page_title: "Leaderboard"
page_title: "Leaderboard"


# Messages
# 信息
messages:
messages:
     # Time options. These are used in the dropdown select menu.
     # 时间选项. These are used in the dropdown select menu.
     alltime: "all time"
     alltime: "全服"
     monthly: "this month"
     monthly: "本月"
     weekly: "this week"
     weekly: "本周"
     daily: "today"
     daily: "今天"
     # High formats as they appear when enabling 'format_high_numbers'.
     # 高位数格式.
     high_formats:
     high_formats:
         thousands_format: "k"
         thousands_format: ""
         millions_format: "M"
         millions_format: "百万"
         billions_format: "B"
         billions_format: "B"
         trillions_format: "T"
         trillions_format: "T"
第37行: 第38行:
     # Time formats
     # Time formats
     time_formats:  
     time_formats:  
         time_format_days: "{days} days, {hours} hours, {minutes} minutes"
         time_format_days: "{days} , {hours} , {minutes} "
         time_format_hours: "{hours} hours, {minutes} minutes"
         time_format_hours: "{hours} , {minutes} "
         time_format_minutes: "{minutes} minutes"
         time_format_minutes: "{minutes} "
      
      
# Tables that appear as you want. You can remove and add as much tables as you want.
# 显示的板块. 你可以移除或添加板块.
leaderboards:
leaderboards:
     # Name of the table. This name appears in the header and the caption if no other text is set.
     # 板块名. 这个名称户会出现在标题.
     "My Server":
     "我的服务器":
         # Columns of the table. You can remove and add as much columns as you want.
         # Columns of the table. 你可以自由修改.
         # The configuration works on a default-based system. This means that there's a set amount of default values.
         # 配置按默认的系统运行. 即使用默认的数值.
         # If you didn't specifically set the setting in the config of a column, the default value will be applied.
         # If you didn't specifically set the setting in the config of a column, the default value will be applied.
         # If a value has been set for the table, this value will be applied for all columns where this value isn't set.
         # If a value has been set for the table, this value will be applied for all columns where this value isn't set.
第52行: 第53行:
         # Tables also use this system, which means that you can specifically set a setting for a certain table.
         # Tables also use this system, which means that you can specifically set a setting for a certain table.
         columns:
         columns:
             # Name of your row as it appears in the first column.
             # 在第一行显示的数据.
             "Time played":
             "Time played":
                 # The name of the statistic as used in-game.
                 # 游戏内的数据名.
                 type: "played"
                 type: "played"
                 statistic_type: "time"
                 statistic_type: "time"
第98行: 第99行:
             server: default
             server: default
defaults:
defaults:
     # Available time periods to select from using the dropdown menu.
     # 可用的时间间隔.
     available_time_types: ["alltime", "monthly", "weekly", "daily"]
     available_time_types: ["alltime", "monthly", "weekly", "daily"]
     # The width of the table.
     # 板块宽度.
     table_width: 800px;
     table_width: 800px;
     # How many players are shown in the table.
     # 显示多少名玩家.
     count: 20
     count: 20
     # Whether there should be a select bar
     # 是否启用选择条
     enable_select: true
     enable_select: true
     # Text in the select bar.  
     # 选择条的内容.  
     # {time} represents the time select dropdown menu.
     # {time} 代表 time select dropdown menu.
     # {type} represents the type select dropdown menu.
     # {type} 代表 type select dropdown menu.
     select_text: "Select for {time} order by {type}"
     select_text: "Select for {time} order by {type}"
     # Whether there should be a bar to select the page above the table.
     # Whether there should be a bar to select the page above the table.
第351行: 第352行:
===== Tweaks =====
===== Tweaks =====


==== Rewrite Rules ====
==== 改写规则 ====


By default, clicking on a player in the leaderboard will give you an error because URL rules aren't set up.
默认配置下你点击一名排行榜内的玩家你会跳转到易错错误的链接,因为你没有设置正确的地址.
Here's how you make URL's that look like the following:
以下为链接的格式:


www.robindebaets.be/leaderboard
www.robindebaets.be/leaderboard
www.robindebaets.be/player/RobiRami
www.robindebaets.be/player/RobiRami


== For sites running Apache ==
== 对于使用 Apache 的网站 ==
Navigate to the ''.htaccess'' file in the public_html root of your website. If this file does not exist, create it.
Navigate to the ''.htaccess'' file in the public_html root of your website.  
Paste this at the very top of your file.
<br />
如果这个文件不存在请手动创建.
把以下内容复制到该文件内.
<code>
<code>
# LEADERHEADS BEGIN
# LEADERHEADS BEGIN
第371行: 第374行:
</code>
</code>


== For sites running Nginx ==
== 对于使用 Nginx 的网站==
Here's the full example from a site running nginx in the ''/etc/nginx/sites-available/default'' file.
这里有完全的示例来使用Nginx :  ''/etc/nginx/sites-available/default'' .


<code>
<code>
第383行: 第386行:
</code>
</code>


==== Integrating into your website ====
==== 关联你的网站 ====


To integrate the leaderboard into your own server forum page, you can either just add a direct to it or directly integrate it in the website and put your own navigation bar in it. To display a leaderboard on a page of your forum, you must use an ''iframe''. Here's an example:
想要关联排行榜到你的服务器论坛页面内, you can either just add a direct to it or directly integrate it in the website and put your own navigation bar in it.如果你想要直接在你的服务器论坛显示排行榜, 你必须使用 ''iframe''. 以下为示例代码:
<code><iframe src="http://ww.robindebaets.be/leaderheads/leaderboard.php" width="100%" height="300px" scrolling="no" frameborder="0"></iframe></code>
<code><iframe src="http://ww.robindebaets.be/leaderheads/leaderboard.php" width="100%" height="300px" scrolling="no" frameborder="0"></iframe></code>


To show stats on a player's Xenforo profile, follow this setup. Keep in mind that these stats are currently only name based so this will only work if the Xenforo profile name is the same as his Minecraft username.
如果你想要显示一名玩家的 Xenforo 简介, 以下为安装步骤. Keep in mind that these stats are currently only name based so this will only work if the Xenforo profile name is the same as his Minecraft username.


Go to the Xenforo control panel, go to Appearance and select ''Templates''.
Xenforo 的控制面板内, 找到 Appearance 并选择 ''Templates'' 模版.
Search for the ''member_view'' of your Xenforo theme and go to the editor.
查找 ''member_view'' of your Xenforo theme and go to the editor.
I recommend making a backup first so you don't break your installation.
I recommend making a backup first so you don't break your installation.
Search for an 'ul' element with the class "mainTabs". This ''ul'' should contain several ''li'' elements. Add a new ''li'' add the end to make a link to the stats interface.
Search for an 'ul' element with the class "mainTabs". This ''ul'' should contain several ''li'' elements. Add a new ''li'' add the end to make a link to the stats interface.

2018年8月26日 (日) 03:50的版本

本条目已有一定量的内容,但仍需完善

欢迎参与本条目的完善工作

你可以从以下几个方面入手

  • 参阅格式化手册,并对该页面进行相应格式排版工作;
  • 日常检查是否内容有更新版本并更新该页面;
  • 修复该页面中已出现/潜在的问题

LeaderHeads 网页插件可以让你在网页上看到玩家的数据记录. 这一插件拥有大量特性且高度可自定义.

网页插件配置

LeaderHeads网页插件旨在让你简单地建立更高级的排行榜而不需要深奥的数据库知识.

你只需要知道默认数值的概念并修改服务器配置, 那么你就可以很容易地上手. 解释在 leaderboard_config.ymlstats_config.yml 内.

在配置中的服务器 选项指的是 database.yml里的服务器 file on your Minecraft server. If you want a column or table to sync from for example your SkyWars server, set the server option in the database.yml to skywars and use skywars as server in the below configuration files.

leaderboard_config.yml <spoiler># 这是排行榜的配置文件.


  1. 搜索引擎显示的描述.

description: "Leaderboards"

  1. 浏览器网页显示的标题.

page_title: "Leaderboard"

  1. 信息

messages:

   # 时间选项. These are used in the dropdown select menu.
   alltime: "全服"
   monthly: "本月"
   weekly: "本周"
   daily: "今天"
   # 高位数格式.
   high_formats:
       thousands_format: "千"
       millions_format: "百万"
       billions_format: "B"
       trillions_format: "T"
       quadrillions_format: "QD"
       quintillions_format: "QT"
       sextillions_format: "SX"
       septillions_format: "SP"
   # Time formats
   time_formats: 
       time_format_days: "{days} 天, {hours} 时, {minutes} 分"
       time_format_hours: "{hours} 时, {minutes} 分"
       time_format_minutes: "{minutes} 分"
   
  1. 显示的板块. 你可以移除或添加板块.

leaderboards:

   # 板块名. 这个名称户会出现在标题.
   "我的服务器":
       # Columns of the table. 你可以自由修改.
       # 配置按默认的系统运行. 即使用默认的数值.
       # If you didn't specifically set the setting in the config of a column, the default value will be applied.
       # If a value has been set for the table, this value will be applied for all columns where this value isn't set.
       # Explanation of these settings can be found under the defaults section.
       # Tables also use this system, which means that you can specifically set a setting for a certain table.
       columns:
           # 在第一行显示的数据.
           "Time played":
               # 游戏内的数据名.
               type: "played"
               statistic_type: "time"
               width: 13%
           "Kills":
               type: "kills"
           "Deaths":
               type: "deaths"
           "Walked Blocks":
               type: "walk"
           "Balance":
               type: "balance"
               format: "${amount}"
               format_high_numbers: true
           "Level":
               type: "bl-level"
           "Items dropped":
               type: "drop"
       settings:   
           server: default
           count: 20
           enable_search_bar: true
           enable_upper_pagination: true
           enable_lower_pagination: true
           enable_caption: false
           enable_header: true
           enable_column_select: true
           enable_select: true
           enable_index_column: true
   "My second server":
       columns:
           "Kills":
               type: "kills"
           "Deaths":
               type: "deaths"
           "Walked Blocks":
               type: "walk"
           "Balance":
               type: "balance"
               format: "${amount}"
               format_high_numbers: true
       settings:    
           server: default

defaults:

   # 可用的时间间隔.
   available_time_types: ["alltime", "monthly", "weekly", "daily"]
   # 板块宽度.
   table_width: 800px;
   # 显示多少名玩家.
   count: 20
   # 是否启用选择条
   enable_select: true
   # 选择条的内容. 
   # {time} 代表 time select dropdown menu.
   # {type} 代表 type select dropdown menu.
   select_text: "Select for {time} order by {type}"
   # Whether there should be a bar to select the page above the table.
   enable_upper_pagination: true
   # Whether there should be a bar to select the page under the table.
   enable_lower_pagination: true
   # How many pages appear in the bar to select pages.
   pagination_size: 10
   # Whether there should be a search bar above the table.
   enable_search_bar: true
   # Placeholder of the text in this search bar.
   search_bar_button_placeholder: "Username"
   # Text in the search button of this search bar.
   search_bar_button_text: "Search Player"
   # URL that this global search bar redirects to.
   search_bar_url: "/player/{name}"
   # Whether a little image of the player's skull should be displayed next to the player's name.
   enable_skull: true
   # The URL of the skull.
   skull_url: "https://crafatar.com/avatars/{name}"
   # Whether there should be a column indicating the index.
   enable_index_column: true
   # Width of the index column.
   index_column_width: 6%
   # Text in the header of the index column.
   index_column_text: ""
   # Format of the index column
   index_column_format: "{rank}"
   # Width of the player column.
   player_column_width: 10%
   # Text in the column with the player name.
   player_column_text: "Player"
   # Whether the table should have a caption or not.    
   enable_caption: false
   # Whether the caption should have custom text instead of the name of the table.
   enable_caption_custom_text: false
   # Custom text of the caption if 'enable_caption_custom_text' is set to true.
   caption_custom_text: "Leaderboard"
   # Whether the table should have a header or not. The name of this table will be displayed in the header.
   enable_header: true
   # Whether you can press the header of the column to order by that statistic.
   enable_column_select: false
   # Whether you can press on a player's name to go to his profile.
   enable_click_name: true
   # URL that you get redirected to when clicking on the player's name.
   click_name_url: "/player/{name}"
   # Default column settings
   columns:
       # Default column server
       server: default
       # Default column format.
       format: "{amount}"
       # Default statistic type of a column. Use 'default' for normal statistics and 'time' for time related statistics.
       statistic_type: "default"
       # Default decimals that should be shown after the decimal point.
       decimals: 0
       # Whether there should be a dot between every 3 digits.
       format_3_digits: false
       # Whether the statistic should be formatted with the values from 'high_formats'.
       format_high_numbers: false
       # Width of this column.
       width: 8%;
       # Whether this column should stay to the time_type from the config, even when the dropdown menu is used
       keep_time_type: false
       # The selected time period of this statistic. Options are 'alltime', 'monthly', 'weekly' and 'daily'.
       time_type: "alltime"

settings:

   # Whether there should be a page header above the tables.
   enable_page_header: true
   # Text of the page header.
   page_header_text: "Leaderboards"
   # Whether there should be a global search bar above the tables.
   enable_global_search_bar: true
   # Placeholder of the text in the global search bar.
   global_search_bar_button_placeholder: "Username"
   # Text in the search button of the global search bar.
   global_search_bar_button_text: "Search Player"
   # URL that the global search bar redirects to.
   global_search_bar_url: "/player/{name}"

</spoiler>

stats_config.yml <spoiler># This is the configuration file for a personal stats page.


  1. The description of the page as it appears in a search engine description.

description: "Player stats"

  1. The title of the page as it appears in the tab of your browser.

page_title: "{name} - Stats"

  1. Messages

messages:

   # High formats as they appear when enabling 'format_high_numbers'.
   high_formats:
       thousands_format: "k"
       millions_format: "M"
       billions_format: "B"
       trillions_format: "T"
       quadrillions_format: "QD"
       quintillions_format: "QT"
       sextillions_format: "SX"
       septillions_format: "SP"
   # Time formats
   time_formats: 
       time_format_days: "{days} days, {hours} hours, {minutes} minutes"
       time_format_hours: "{hours} hours, {minutes} minutes"
       time_format_minutes: "{minutes} minutes"
   # Last seen time message
   last_seen: 
       year_ago: "%y year ago"
       years_ago: "%y years ago"
       month_ago: "%m month ago"
       months_ago: "%m months ago"
       day_ago: "%d day ago"
       days_ago: "%d days ago"
       hour_ago: "%h hour ago"
       hours_ago: "%h hours ago"
       minute_ago: "%i minute ago"
       minutes_ago: "%i minutes ago"
       just_now: "just now"
       never_joined: "Never joined"
   # Last seen message.
   last_seen_message: "Last seen: {time}"
   # The message that appears instead of the name if the searched player doesn't exist.
   not_exist: "This player does not exist"
   
  1. Tables that appear as you want. You can remove and add as much tables as you want.

tables:

   # Name of the table. This name appears in the header and the caption if no other text is set.
   "My first server":
       # Rows of the table. You can remove and add as much rows as you want.
       # The configuration works on a default-based system. This means that there's a set amount of default values.
       # If you didn't specifically set the setting in the config of a row, the default value will be applied.
       # Explanation of these settings can be found under the defaults section.
       # Tables also use this system, which means that you can specifically set a setting for a certain table.
       rows:
           # Name of your row as it appears in the first column
           "Kills":
               # The name of the statistic as used in-game
               type: "kills"
           "Deaths":
               type: "deaths"
           "Walked Blocks":
               type: "walk"
           "Balance":
               type: "balance"
               format: "${amount}"
               format_high_numbers: true
       settings:    
           server: default
           table_width: 400px
   "My second server":
       rows:
           "Weekly blocks walked":
               type: "walk"
               time_type: "weekly"
           "Deaths":
               type: "deaths"
           "Level":
               type: "bl-level"
           "Items dropped":
               type: "drop"
       settings:    
           server: default
           table_width: 400px
   "My third server":
       rows:
           "Time played":
               type: "played"
               statistic_type: "time"
           "Blocks mined":
               type: "ez-blocks"
           "Walked Blocks":
               type: "walk"
       settings:    
           server: default
           table_width: 400px

defaults:

   # The width of the table.
   table_width: 400px;
   # Whether the table should have a caption or not.
   enable_caption: false
   # Whether the caption should have custom text instead of the name of the table.
   enable_caption_custom_text: false
   # Custom text of the caption if 'enable_caption_custom_text' is set to true.
   caption_custom_text: "Leaderboard"
   # Whether the table should have a header or not. The name of this table will be displayed in the header.
   enable_header: true
   # Width of the column where the name of the statistic appears.
   index_width: 50%
   # Default row settings
   rows:
       # Default column server
       server: default
       # Default column format.
       format: "{amount}"
       # Default statistic type of a column. Use 'default' for normal statistics and 'time' for time related statistics.
       statistic_type: "default"
       # The selected time period of this statistic. Options are 'alltime', 'monthly', 'weekly' and 'daily'.
       time_type: "alltime"
       # How many decimals should be shown after the decimal point.
       decimals: 0
       # Whether there should be a dot between every 3 digits.
       format_3_digits: false
       # Whether the statistic should be formatted with the values from 'high_formats'.
       format_high_numbers: false
       # Width of the statistic column of this row.
       width: 50%;
       

settings:

   # Whether there should be a page header above the tables.
   enable_page_header: true
   # Text of the page header.
   page_header_text: "Player Statistics"
   # Whether there should be a global search bar above the tables.
   enable_global_search_bar: true
   # Placeholder of the text in the global search bar.
   global_search_bar_button_placeholder: "Username"
   # Text in the search button of the global search bar.
   global_search_bar_button_text: "Search Player"
   # URL that the global search bar redirects to.
   global_search_bar_url: "/player/{name}"
   # Interval in minutes for when a player will be seen as 'just now' online.
   last_seen_interval: 2
   # URL of the player picture that appears.
   player_picture: "https://crafatar.com/renders/body/{name}?overlay=true"
   # Update interval in seconds
   # This will auto update the stats of the player in realtime without refreshing the page
   update-interval: 10

</spoiler>

安装网页插件
  1. -配置你的 database.yml 并连接到 MySQL 数据库. 如果你的服务器有同名的数据的话,推荐使用database.yml内的 'server'选项来区分这些数值 (例如空岛战争的击杀数据和龙蛋战争的击杀数据)
  2. - 下载网页插件, 打开它并上传至 leaderheads 文件夹到你的网站根目录下 public_html root. 你可以重命名文件夹.
  3. - 要想显示数据, 你需要到 statistics文件夹并查找插件数据.打开一个文件并把 force-update 改为 true 来确保插件正常发送数据.
  4. - 在网页插件文件夹config'的 config.php内配置你的 MySQL.
  5. - 找到 leaderboard.php 和/或 stats.php文件来检测是否成功连接数据库.
  6. - 编辑配置文件夹内的 .yml follow the comments in the files.
  7. - 搜索栏和点击名称功能默认关闭. 你需要安装 URL rewrite rules来使用这一特性. 想要了解详情, 请查看 **Rewrite Rules** 部分.
Tweaks

改写规则

默认配置下你点击一名排行榜内的玩家你会跳转到易错错误的链接,因为你没有设置正确的地址. 以下为链接的格式:

www.robindebaets.be/leaderboard www.robindebaets.be/player/RobiRami

对于使用 Apache 的网站

Navigate to the .htaccess file in the public_html root of your website.
如果这个文件不存在请手动创建. 把以下内容复制到该文件内.

  1. LEADERHEADS BEGIN

RewriteEngine on Options +FollowSymLinks RewriteRule ^leaderboard/?$ /leaderheads/leaderboard.php [L,NC] RewriteRule ^player/([^/]+)/?$ /leaderheads/stats.php?player=$1 [L,QSA,NC]

  1. LEADERHEADS END

对于使用 Nginx 的网站

这里有完全的示例来使用Nginx : /etc/nginx/sites-available/default .

server {

   ...
   rewrite ^/leaderboard/?$ /leaderheads/leaderboard.php;
   rewrite ^/player/([^/]+)/?$ /leaderheads/stats.php?player=$1 last;
   ...

}

关联你的网站

想要关联排行榜到你的服务器论坛页面内, you can either just add a direct to it or directly integrate it in the website and put your own navigation bar in it.如果你想要直接在你的服务器论坛显示排行榜, 你必须使用 iframe. 以下为示例代码: <iframe src="http://ww.robindebaets.be/leaderheads/leaderboard.php" width="100%" height="300px" scrolling="no" frameborder="0"></iframe>

如果你想要显示一名玩家的 Xenforo 简介, 以下为安装步骤. Keep in mind that these stats are currently only name based so this will only work if the Xenforo profile name is the same as his Minecraft username.

在 Xenforo 的控制面板内, 找到 Appearance 并选择 Templates 模版. 查找 member_view of your Xenforo theme and go to the editor. I recommend making a backup first so you don't break your installation. Search for an 'ul' element with the class "mainTabs". This ul should contain several li elements. Add a new li add the end to make a link to the stats interface. After changing the code, it should look something like this.

    li" data-history="on"> ...
  • <a href="{$requestPaths.requestUri}#stats">{xen:phrase Stats}</a>
  • ...

Now that the link is done, we need to add the actual interface.

Search for the ul with id ProfilePanes, add in a new li at the end to show the stats interface. After changing the code, it should look something like this. Make sure to add the correct URL of the the personal stats page.