SmartChatClear
Description
With this plugin you can clear all the chat, your chat or the chat of a specified player. The chat is removed completly by replacing 120 empty lines, but you can edit the last 20 lines with everything you want. You can leave a empty line or write a message you want.
Features
- Clears 120 lines.
- The last 20 lines are editable.
- Making a line empty.
- Fast usage.
- Color support.
- Getting player name (which execute command) on every line.
How to install
- 1) Download the plugin.
- 2) Enter in 'server-directory/plugins' and put the plugin there.
- 3) Start/reload the server.
- 4) Edit the config.yml then reload the server.
How to configure
Default config.yml:
private-messages: true lines: '1': This is line 1. '2': This is line 2. '3': This is line 3. '4': This is line 4. '5': This is line 5. '6': This is line 6. '7': This is line 7. '8': This is line 8. '9': This is line 9. '10': This is line 10. '11': This is line 11. '12': This is line 12. '13': This is line 13. '14': This is line 14. '15': This is line 15. '16': This is line 16. '17': This is line 17. '18': This is line 18. '19': This is line 19. '20': This is line 20.
- How to make an empty line. You need to add 'none' on specified line.
Example:
lines: '1': This is line 1. '2': none #This line will be empty. '3': This is line 3.
- How to get player name (which execute the command). You need to add %PLAYER% on the specified line.
Example:
lines: '1': This is line 1. '2': This is line 2. '3': Chat cleared by %PLAYER%. #It will be like Chat cleared by <NAME OF PLAYER>. '4': This is line 4. '5': This is line 5.
- How to set private messages. (commands: /ccm and /ccp) You need to set 'private-messages' boolean. If boolean is 'true' then players with recive the messages, if is 'false' it won't recive.
Example:
private-messages: true #This will enable '<player> has cleared your chat.' etc.
Commands / Permissions
- /smartchatclear - Main command. (permission: no permission)
- /smartchatclear help - Shows the screen with commands. (permission: smartchatclear.help)
- /smartchatclear reload - Reloads the config.yml (permission: smartchatclear.reload)
- /cc - Clears the chat for all players. (permission: smartchatclear.cc)
- /ccp <player> - Clears the chat for a specified player. (permission: smartchatclear.ccp)
- /ccm - Clears your chat. (permission: smartchatclear.ccm)
Change log
v1.1.0
- Added Metrics.
- Added to config.yml 'private-messages' which changes messages to '/ccm' and '/ccp'.
- Changed the send client message method.
- Added '/smartchatclear reload' to reload config.yml.
v1.0.2
- Updated for 1.4.7.
v1.0.1
- Added color support.
v1.0.0
- Release
Suggestions
If you have any suggestions for this plugin leave a comment with it or just PM me.
@xGh0sTkiLLeRx
Ok, i'll try compiling with it.
PS: Can somebody make me a video? My PC's lagging so much when i'm recording!
@kaZep
Of course it will work!
Java 7 is "backwards" compatible!
@Hoolean
Thanks, i'm at begging and i'm still learning java.
@Lolmewn
If i compile it in java 6 it won't work on 7...
@kaZep
You could just compile it in Java 6, nothing in your plugin uses the new stuff from Java 7 anyway.
String toSend = "";
for(int i = 0; i<numberOfLinesYouWant; i) {
toSend += "\n";
}
sender.sendMessage(toSend);
OR
sender.sendMessage("");
sender.sendMessage("");
sender.sendMessage("");
sender.sendMessage("");
sender.sendMessage("");
etc...
Your choice :D
@kaZep
never mind, now it works. But i did not change anything...strange.
¡Best plugin ever!
@xGh0sTkiLLeRx
Thanks, i'm begginer at the moment :)
@javieraizpuru
Are you sure as you did everything good? I retested it and it's working fine.
Suggestion:
Learn to use the possibilities of Java.
Instead of copying the same line everytime use a loop.
Read more about it here: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html
You can thank me later (:
Thanks, i just updated java, but i still have a problem. The only command working is /smartchatclear. And the others only work if im OP. My permission plugin is PEX and im using vault.
@javieraizpuru
I think it's from your java Verison, it needs Java 7.
can't install :(. Bukkit ver: 1.4.6-R0.3
Error:
[SEVERE] Could not load 'plugins/SmartChatClear.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException java.lang.UnsupportedClassVersionError me/kaZep/SmartChatClear/Main : Unsupported major.minor version 51.0
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:184)
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:305)
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:230)
at org.bukkit.craftbukkit.v1_4_6.CraftServer.loadPlugins(CraftServer.java:239)
at org.bukkit.craftbukkit.v1_4_6.CraftServer.<init>(CraftServer.java:217)
at net.minecraft.server.v1_4_6.PlayerList.<init>(PlayerList.java:52)
at net.minecraft.server.v1_4_6.DedicatedPlayerList.<init>(SourceFile:11)
at net.minecraft.server.v1_4_6.DedicatedServer.init(DedicatedServer.java:104)
at net.minecraft.server.v1_4_6.MinecraftServer.run(MinecraftServer.java:399)
at net.minecraft.server.v1_4_6.ThreadServerApplication.run(SourceFile:849)
Caused by: java.lang.UnsupportedClassVersionError me/kaZep/SmartChatClear/Main : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at org.bukkit.plugin.java.PluginClassLoader.findClass0(PluginClassLoader.java:80)
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:53)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:173)
... 9 more
cool, i'm going to try it tomorrow :D