Skip to content
This repository was archived by the owner on Aug 3, 2018. It is now read-only.

Commit

Permalink
Remove time variables
Browse files Browse the repository at this point in the history
  • Loading branch information
q1an1x committed Apr 6, 2017
1 parent faebcad commit 85bda0a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 19 deletions.
4 changes: 1 addition & 3 deletions nukkit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ Simply change the texts or messages which is sent by the server or other plugins
Put it into your plugins folder.

# Configuration
Edit ./plugins/TextReplacer/config.yml.
Check ./plugins/TextReplacer/config.yml.

# Available Variables
Player Name: {PLAYER}

Time: {YEAR}, {MONTH}, {DAY}, {HOUR}, {MINUTE}, {SECOND}

Level Name: {LEVEL}
7 changes: 2 additions & 5 deletions nukkit/resources/config.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# TextReplacer for Nukkit
# Simply change the texts or messages which is sent by the server or other plugins.
# Available variables: {PLAYER}, {MONTH}, {DAY}, {HOUR}, {MINUTE}, {SECOND}
# Available variables: {PLAYER}, {LEVEL}
# Format: "Text to be replaced": "Text you want"

# Message on player joined.
"{PLAYER} joined the game.": "Welcome {PLAYER} to the server!"

# Message on time displaying.
"Current Time: {MONTH}/{DAY} {HOUR}:{MINUTE}:{SECOND}": "Today: {MONTH}/{DAY}\nTime: {HOUR}:{MINUTE}:{SECOND}"
"{PLAYER} joined the game.": "Welcome {PLAYER} to the server!"
12 changes: 1 addition & 11 deletions nukkit/src/taylcd/TextReplacer.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package taylcd;

/*
* Make the world a better place.
*/

import cn.nukkit.event.EventHandler;
import cn.nukkit.event.EventPriority;
import cn.nukkit.event.Listener;
Expand Down Expand Up @@ -49,13 +45,7 @@ public void onDataPacketSend(DataPacketSendEvent event) {
HashMap<String, String> variables = new HashMap<String, String>() {
{
put("{PLAYER}", name);
put("{YEAR}", String.valueOf(time.get(Calendar.YEAR)));
put("{MONTH}", String.valueOf(time.get(Calendar.MONTH) + 1));
put("{DAY}", String.valueOf(time.get(Calendar.DAY_OF_MONTH)));
put("{HOUR}", String.valueOf(time.get(Calendar.HOUR_OF_DAY)));
put("{MINUTE}", String.valueOf(time.get(Calendar.MINUTE)));
put("{SECOND}", String.valueOf(time.get(Calendar.SECOND)));
put("{LEVEL}", event.getPlayer().getLevel().getName());
put("{LEVEL}", event.getPlayer().getLevel().getName());
}
};

Expand Down

0 comments on commit 85bda0a

Please sign in to comment.