描述
大家好,由于 Billy 已无暇继续维护此插件,我将接手负责更新!近期请关注更新动态,我计划修复因更新灯具而导致的卡顿问题,确保其在大多数主要的 CB(CraftBukkit)版本上正常运行,并添加许多新功能!敬请期待……
Pl3xLamps 允许你的红石灯在游戏内的特定时间段无需供电也能保持开启状态。想要只在夜间自动亮起的街灯?还是仅在黄金时段点亮的灯具?亦或是始终常亮的灯?无论何种需求,你都可以使用此插件完全控制它们的开关时间。
这绝不会影响普通红石灯的原有功能,因此你的红石装置不会损坏!
不依赖其他插件,也不进行任何 NMS(非标准 Minecraft 服务器代码)调用!本插件完全基于 Bukkit API 开发,因此在不同的 CB 构建版本间不会出现兼容性问题!
更新:Pl3xLamps 现在利用 Bukkit 内置的 JDBC 原生支持。这意味着你的 plugins 文件夹中不再需要 lamps.yml 文件!取而代之的是默认生成的 Pl3xLamps.db 文件。这是一个 SQLite 数据库,包含所有保存的灯具数据。如果你已在 Bukkit.yml 中配置为使用 MySQL 服务器,则必须在指定位置创建一个名为 "Pl3xLamps" 的空表,否则插件将无法加载。
要将旧的 lamps.yml 数据转换为新数据库,请使用命令 /pl3xlamps convert (此操作仅适用于从 v0.0.3 或更早版本升级的用户!)
更新:你现在可以拥有多个具有各自开启时间的灯具名称!例如,一些街灯在夜间保持开启,而室内灯则全天常亮。你可以拥有的不同灯具类型数量没有限制(除了受限于内存/CPU)。以下是 v0.0.7 起的新 config.yml 格式示例,用于支持多个灯具名称:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 | # 启用后将在控制台输出大量信息
debug-mode: false
# 启用后将在控制台输出极多信息(可能导致卡顿)
spammy-debug-mode: false
# 启用后控制台日志将以彩色显示
color-logs: true
# 检查时间以开启/关闭灯具的频率(刻/ticks)
check-interval: 20
# 在此处设置你的灯具。
# 灯具 '0' 将作为默认灯具(用于向后兼容)
lamps:
0:
name: Street Lamp
turn-on-condition: 'time>13000&&time<23000'
1:
name: Indoor Lamp
turn-on-condition: 'true'
|
请注意,你必须手动更新 config.yml 以确保插件正常工作。如果是新用户,只需取消注释最后几行即可。如果是从旧版本升级,你需要手动用新内容替换旧行(参见示例),或者删除旧文件,插件将在启动时自动生成一个新文件。
升级用户请注意! 你在 v0.0.6 及更低版本中创建的旧灯具仍将继续正常工作。它们将自动假设其名称为你在 config.yml 中指定的 lamps.0.name 的值。这是因为旧版插件未保存灯具名称所致。但是,为了防止插件因旧数据库文件而崩溃,你必须使用 SQLite 查看器程序手动更新它。简化后的操作步骤已放置在常见问题解答(FAQ)部分供你参考。
玩得开心!^_^
命令
- /pl3xlamps (reload) 查看插件版本或从磁盘重新加载 config.yml 中的配置值。
- /pl3xlamps (convert) 将旧的 lamps.yml 数据转换为新的数据库数据。(仅适用于从 v0.0.3 或更低版本升级!)
权限
- pl3xlamps.pl3xlamps 允许使用 /pl3xlamps 命令
- pl3xlamps.create 允许在铁砧上制作灯
- pl3xlamps.place 允许放置灯
- pl3xlamps.break 允许破坏灯
- pl3xlamps.use 等同于同时赋予 create、place 和 break 权限节点
常见问题解答 (F.A.Q.)
- 我在 config.yml 中设置了不同的名称,但不起作用!
首先,这不算一个问题。其次,这是因为你需要完全重启服务器。简单的重载在这里不起作用。另外请非常小心更改名称!所有以旧名称创建(但未放置)的灯将不再工作。所有这些灯都需要重新命名为新名称。 从 v0.0.7 版本开始,这已不再是问题。
- 插件升级后,它在服务器启动时不断自行禁用!
- 你需要手动修改 config.yml 文件,将默认灯设置为新结构。请参阅上面的示例粘贴内容。
- 插件升级后持续崩溃,并出现缺少 "name" 列的 SQL 错误
- 这是 Bukkit 中使用的 eBean SQL 库的一个限制。一旦创建了数据库表(在此情况下添加 "name" 列),目前无法对其进行修改,因此你必须手动添加。建议使用 SQLite 查看器轻松操作你的 Pl3xLamps.db 文件。我推荐(且已测试有效)使用 来完成此操作。只需打开 .db 文件,点击“修改表”按钮,点击“编辑”按钮,点击“添加字段”按钮,字段名为 "name",字段类型为 "text"。保存 .db 文件并将其重新上传到服务器,然后启动 Bukkit,该错误就会消失。
- 为什么会有如此多的延迟/CPU 占用?
- 你的 检查间隔 (check-interval) 设置得太低了。每个间隔插件都会检查每一个灯,因此设置过低显然会导致大量 CPU 占用,进而可能导致服务器卡顿。我建议保持在 20 tick 或更高(20 tick 等于 1 秒),但我强烈建议将其设置为 100 tick(5 秒)。没人会注意到灯光提前或延迟 5 秒亮起或熄灭,而这将节省你宝贵的服务器资源免受卡顿困扰。
- 为什么我的用户不能创建/放置/破坏灯?
- 你没有设置正确的权限节点。请参阅上文。
- Pl3xLamps 在我的控制台中刷屏了!我该如何让它停止?
- 调试消息默认是关闭的。你一定是把它们打开了……请在 config.yml 文件中将它们重新关闭。
- 这个 Pl3xLamps.db 文件是怎么回事?
- 不要碰它。它是你在服务器上所有灯的保存数据。如果你删除或修改它,部分或全部灯可能会停止工作,需要重新放置才能修复。
截图



待办事项 (TODO)
为放置/创建/破坏添加权限节点 已在 v0.0.3 中添加
添加可配置的开启/关闭时间(当前在 13000 [晚上 7:00] 到 23000 [凌晨 5:00] tick 之间开启) 已在 v0.0.4 中添加
添加可配置的检查更新(当前硬编码为 20 tick) 已在 v0.0.3 中添加
添加可配置的名称(当前硬编码为 Street Lamp) 已在 v0.0.3 中添加
添加具有不同名称和不同时间条件的多个灯的能力 已在 v0.0.7 中添加
- 欢迎提出建议..
指标 (Metrics)
本插件使用 Metrics 来收集统计数据!它仅收集基本信息,如版本类型和在线玩家数量。如果你想查看所有内容,请点击图表。如果希望禁用统计收集,请进入 /plugins/PluginMetrics/config.yml 进行设置。

Description
Hello all, I wil be taking over this plugin as Billy no longer has the time to keep them going! Look out for updates in the near future, as I intend to try and fix the lag caused by updating the lamps, update and make sure it is working on most major CB versions, as well as add many new features! Watch this space...
Pl3xLamps allows your redstone lamps to stay turned on without power during certain in-game times. Want street lamps that come on at night only? How about lamps that are only on during prime hours? Maybe lamps that stay on all the time? Whatever case it may be, you have complete control over when they are turned on with this plugin.
This will NOT mess with the normal Redstone Lamp's functionality at all, so your redstone contraptions will NOT break!
No dependencies of other plugins, and no NMS calls at all! This is 100% using the Bukkit API so it wont break between CB builds!
Update: Pl3xLamps now utilizes the built in JDBC native to Bukkit. This means no more lamps.yml in your plugins folder! Instead, there will be a Pl3xLamps.db file in there by default. This is an SQLite database that contains all your saved lamp data. If you have configured your Bukkit.yml to use a MySQL server, instead, then you MUST create an empty table where you specified in the Bukkit.yml named "Pl3xLamps" or the plugin will fail to load.
To convert your old lamps.yml data to the new database, use the command /pl3xlamps convert (this is ONLY for users upgrading from v0.0.3 or earlier versions!)
Update: You can now have multiple lamp names that have their own times to be on! Have some street lamps that stay on at night and some indoor lamps that stay on all the time. There is no limit (except maybe your RAM/CPU) to how many different ones you can have. Here is an example of the new config.yml format (starting with v0.0.7) to utilize multiple lamp names:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 | # Enable to spam the console with stuffs
debug-mode: false
# Enable to spam the console with LOTS of stuffs (can create lag)
spammy-debug-mode: false
# Enable to have console logs in color
color-logs: true
# How often to check the time to turn on/off the lamps (ticks)
check-interval: 20
# Setup your lamps here.
# Lamp '0' will be used as the default lamp (for backwards compatibility)
lamps:
0:
name: Street Lamp
turn-on-condition: 'time>13000&&time<23000'
1:
name: Indoor Lamp
turn-on-condition: 'true'
|
Please be aware that you must manually update your config.yml for the plugin to work. If you are a new user just simply uncomment the last few lines. If you are upgrading from an older build you will need to manually replace the old lines with the new ones (see the example) or delete your old file and the plugin will generate a new one on startup.
Upgarders Beware! Your old lamps in v0.0.6 and below will still work. They will automatically assume they are named whatever you specify as lamps.0.name in the config.yml. This is a side effect of not saving the lamp names in older versions of the plugin. However in order to prevent the plugin from crashing out with the old database file you must manually update it with an SQLite viewer program. A simplified procedure has been placed in the FAQ section for you.
Enjoy! ^_^
Commands
- /pl3xlamps (reload) View the plugin version or reload the config.yml values from disk.
- /pl3xlamps (convert) Convert the old lamps.yml data into the new database data. (only for upgrading from v0.0.3 or lower!)
Permissions
- pl3xlamps.pl3xlamps Allows access to the /pl3xlamps command
- pl3xlamps.create Allows to create lamps on an anvil
- pl3xlamps.place Allows to place lamps
- pl3xlamps.break Allows to break lamps
- pl3xlamps.use Same as giving the create, place, AND break perm nodes
F.A.Q.
- When I set a different name in the config.yml it doesnt work!
First, that's not a question. Second, it's because you need to restart the server completely. A simple reload wont do the trick here. Also be very careful about changing the name! All lamps created (but not placed) under the previous name will not work anymore. All those lamps will have to be renamed again to the new name. This is no longer an issue starting with v0.0.7.
- After upgrading the plugin it keeps disabling itself on server startup!
- You need to manually modify the config.ym file to setup your default lamps to the new structure. See the example paste above.
- After upgrading the plugin keeps crashing with SQL error of missing column "name"
- This is a limitation with the eBean SQL library used in Bukkit. There is currently no way to modify a database table once its been created (adding the column "name" in this case) so you will have to manually add this yourself. Use an SQLite viewer to do this easily to your Pl3xLamps.db file. I recommend (and have tested it works) using for this. Just simply open the .db file, click the alter table button, click the edit button, click add field button, field name is "name" and the field type is "text". Save the .db file and re-upload it to your server and fire up bukkit and the error will be gone.
- Why is there so much lag/CPU cycles?
- You have your check-interval set way too low. Each interval the plugin checks every single lamp, so setting this too low will obviously cause a lot of CPU cycles that could end up lagging your server. I recommend staying at 20 ticks or higher (20 ticks is 1 second), but I Strongly Recommend setting it to 100 ticks (5 seconds). No one is going to notice the light come on or go off 5 seconds early/late, and its going to save your precious server from lagging.
- Why cant my users create/place/break the lamps?
- You have not setup the proper perm nodes. Please see above.
- Pl3xLamps spams my console! How do I make it stop?
- Debug messages are off by default. You had to have turned them on.... Turn them back off in the config.yml file.
- Whats with this Pl3xLamps.db file?
- Don't touch it. Its your saved data of all your lamps on the server. If you delete or modify it, some or all lamps could stop working, requiring them to be re-placed to fix.
Screenshots



TODO
Add perm nodes for placing/creating/breaking Added v0.0.3
Add configurable times to be on/off (currently ON between 13000 [7:00pm] and 23000 [5:00am] ticks) Added v0.0.4
Add configurable update check (currently hardcoded to 20 ticks) Added v0.0.3
Add configurable name (currently hardcoded to Street Lamp) Added v0.0.3
Add ability to have multiple lamps with different names and different time conditions Added v0.0.7
- I'm up for suggestions..
Metrics
This plugin uses metrics to collect stats! It only collect basic things such as version type, and players online. If you want to see everything, click on the graph. Go into /plugins/PluginMetrics/config.yml to disable stat collecting if you wish.

评论 0
登录后参与评分
还没有评论,来抢沙发吧