Skip to content

Commit 410a357

Browse files
added /last and /unignoreall commands
1 parent 76ebcfe commit 410a357

10 files changed

Lines changed: 246 additions & 141 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
with:
3636
java-version: 1.8
3737

38-
- name: Prepare depdendency cache
38+
- name: Prepare dependency cache
3939
uses: actions/cache@v2
4040
with:
4141
path: ~/.m2

README.md

Lines changed: 26 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
**ChatCo is a simple chat plugin which has the following features:**
44

55
- Players can customize their chat message using various prefixes. As an example putting an '>' before a chat message
6-
will turn the text green (greentext). (Note: Does not change the color of player names).
6+
will turn the text green (green-text). (Note: Does not change the color of player names).
77
- Players can whisper other players (defaults to a purple color).
88
- Players can ignore another player (works for both world and whisper chat). Ignore lists are persistent between logins.
9-
Players can also unignore a previously ignored player.
9+
Players can also un-ignore a previously ignored player.
1010
- Allows for a customizable spoiler text system (who wants to ruin the walking dead for everyone?).
1111
- Players can toggle chat on/off.
1212
- Full permission support so that you can limit who has access to what colors / features.
13-
- Allows the administrator to log whispers between players.
13+
- Allows the administrator to log whispers between players. (Could be against EU law.)
1414

1515
**Popular servers known or thought to be running this plugin:**
1616

@@ -21,47 +21,30 @@
2121

2222
**ADMINISTRATIVE COMMANDS (only console input is accepted):**
2323

24-
Every single command goes by the format "chatco component e/d" where 'e' enables and 'd' disables, e.g. typing "chatco
25-
whisperlog e" in the console will enable whisperlogging. You will have to reload the plugin in order to make most of the
24+
Every single admin command goes by the format "/chatco {component} {e|d}" where 'e' enables and 'd' disables, e.g. typing "/chatco
25+
whisperlog e" in the console will enable whisper logging. You will have to reload the plugin in order to make most of the
2626
changes take effect.
2727

2828
**Components:**
2929

30-
- spoilers
31-
- whispers
32-
- newcommands
33-
- whisperlog
30+
- **spoilers** - enables or disables spoilers, is **disabled** by default.
31+
- **whispers** - enables or disables whisper changes, is **enabled** by default.
32+
- **newcommands** - enables or disables new whisper commands, is **enabled** by default.
33+
- **whisperlog** - enables or disables whisper logging (whisper logs are saved in /ChatCo/whisperlog.txt), is **disabled**
34+
by default.)
3435

3536
**Player Commands:**
3637

37-
- /ignore
38-
- /ignorelist
39-
- /togglechat
40-
- /toggletells
38+
- **/ignore {player}** - ignores or un-ignores the player.
39+
- **/ignorelist** - prints all ignored players.
40+
- **/unignoreall** - clears ignore list
41+
- **/togglechat** - disables regular chatting for the player - NOT PERSISTENT.
42+
- **/toggletells** - disables tells for the player - NOT PERSISTENT,
4143

4244
**Whisper Related Player Commands:**
4345

44-
- /tell
45-
- /pm
46-
- /w
47-
- /msg
48-
- /t
49-
- /whisper
50-
- /r
51-
- /reply
52-
53-
**Legend:**
54-
55-
- spoilers - enables or disables spoilers, is **disabled** by default.
56-
- whispers - enables or disables whisper changes, is** enabled** by default.
57-
- newcommands - enables or disables new whisper commands, is **enabled** by default.
58-
- whisperlog - enables or disables whisper logging (whisper logs are saved in /ChatCo/whisperlog.txt), is **disabled**
59-
by default.
60-
- /ignore <player> - ignores or un-ignores the player.
61-
- /ignorelist - prints all ignored players.
62-
- /togglechat - disables regular chatting for the player - NOT PERSISTENT.
63-
- /toggletells - disables tells for the player - NOT PERSISTENT,
64-
- /r and /reply - replies to the last person who sent you a whisper this session.
46+
- **/r** and **/reply** - replies to the last person who sent you a whisper this session.
47+
- **/l** and **/last** - replies to the last person you sent a whisper to
6548

6649
**Config**\
6750
Color codes and prefixes can be disabled by replacing the contents of "" with "!#" e.g. Green: "!#".\
@@ -71,12 +54,14 @@ You can customize the appearance of whispers.
7154
**Examples:**
7255

7356
- Turn chat off/on with /togglechat.
74-
- Write > at the start of a message for greentext.
57+
- Write > at the start of a message for green-text.
7558
- Write [SPOILER]text[/SPOILER] to make a spoiler.
7659
- Write /show spoiler [1-5] to view spoilers.
7760

7861
**Planned Features:**
7962

63+
- Use UUIDs for ignore lists (and convert old ones)
64+
- Remove redundant code
8065
- Fully Async Chat
8166
- Groups?
8267
- Customizable Death Messages
@@ -90,3 +75,9 @@ You can customize the appearance of whispers.
9075
- 1.10
9176
- 1.9
9277
- 1.8
78+
79+
**Git Release Creation**
80+
```sh
81+
git tag <tag_name>
82+
git push origin <tag_name>
83+
```

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.gmail.fyrvelm.chatco</groupId>
88
<artifactId>ChatCo</artifactId>
9-
<version>0.25</version>
9+
<version>0.26</version>
1010
<packaging>jar</packaging>
1111

1212
<name>ChatCo</name>

src/main/java/com/gmail/fyrvelm/chatco/CCAllChat.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
import java.io.IOException;
1515

1616
public class CCAllChat implements Listener {
17-
private static final String CANCEL = "14CANCELIMMEDIATELY14712381230412A42088";
17+
// TODO: remove that
18+
private static final String CANCEL = "44D88612FEA8A8F36DE82E1278ABB02F";
1819
public final ChatCo plugin;
1920
private FileConfiguration permissionConfig;
2021

@@ -152,7 +153,7 @@ public String ColorCodeManager(String data, final Player player) {
152153

153154
@EventHandler(ignoreCancelled = true)
154155
public void onPlayerChat(final AsyncPlayerChatEvent event) {
155-
File customConfig = ChatCo.Configuration2;
156+
File customConfig = ChatCo.PermissionConfig;
156157
this.permissionConfig = YamlConfiguration.loadConfiguration(customConfig);
157158
final Player player = event.getPlayer();
158159
final Player[] recipients = event.getRecipients().toArray(new Player[0]);

src/main/java/com/gmail/fyrvelm/chatco/CCPlayer.java

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,18 @@ public class CCPlayer {
1313
public boolean chatDisabled;
1414
public boolean tellsDisabled;
1515
public String LastMessenger;
16+
public String LastReceiver;
1617
private File IgnoreList;
1718
private List<String> ignores;
1819

1920
public CCPlayer(final Player p, final String pN) throws IOException {
20-
this.player = p;
21-
this.playerName = pN;
22-
this.chatDisabled = false;
23-
this.tellsDisabled = false;
24-
this.LastMessenger = null;
25-
this.saveIgnoreList("");
21+
player = p;
22+
playerName = pN;
23+
chatDisabled = false;
24+
tellsDisabled = false;
25+
LastMessenger = null;
26+
LastReceiver = null;
27+
saveIgnoreList(""); // "" means only create the file
2628
}
2729

2830
@SuppressWarnings("ResultOfMethodCallIgnored")
@@ -61,6 +63,15 @@ public void saveIgnoreList(final String p) throws IOException {
6163
this.updateIgnoreList();
6264
}
6365

66+
public void unIgnoreAll() throws IOException {
67+
final FileWriter fwo = new FileWriter(this.IgnoreList, false);
68+
final BufferedWriter bwo = new BufferedWriter(fwo);
69+
bwo.flush();
70+
bwo.close();
71+
72+
this.updateIgnoreList();
73+
}
74+
6475
public Player getLastMessenger() {
6576
if (this.LastMessenger != null) {
6677
return Bukkit.getPlayerExact(this.LastMessenger);
@@ -73,6 +84,19 @@ public void setLastMessenger(final Player sender) {
7384
this.LastMessenger = sender.getName();
7485
}
7586

87+
public Player getLastReceiver() {
88+
if (this.LastReceiver != null) {
89+
return Bukkit.getPlayerExact(this.LastReceiver);
90+
}
91+
92+
return null;
93+
}
94+
95+
public void setLastReceiver(final Player sender) {
96+
this.LastReceiver = sender.getName();
97+
}
98+
99+
76100
private void updateIgnoreList() throws IOException {
77101
final FileInputStream file = new FileInputStream(this.IgnoreList);
78102
final InputStreamReader fileReader = new InputStreamReader(file);

0 commit comments

Comments
 (0)