Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>eu.mclive</groupId>
<artifactId>ChatLog</artifactId>
<version>1.13.6-release</version>
<version>1.14.1-release</version>
<name>Chatlog</name>
<description>Chatlog generator to report players</description>

Expand All @@ -26,7 +26,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<version>3.14.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
Expand All @@ -35,7 +35,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.0</version>
<version>3.6.0</version>
<configuration>
<artifactSet>
<includes>
Expand Down Expand Up @@ -73,8 +73,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<!-- Bukkit API Version, change if out dated -->
<version>1.19.4-R0.1-SNAPSHOT</version>
<version>1.21.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<type>jar</type>
</dependency>
Expand All @@ -87,7 +86,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
<version>3.17.0</version>
</dependency>
</dependencies>

Expand Down
4 changes: 3 additions & 1 deletion resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,6 @@ Cleanup:
# How old messages need to be before they are deleted.
since: 14

update-check: true
update-check: true
# How often to check for updates in days, defaults to 1 day
update-interval: 1
12 changes: 8 additions & 4 deletions resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
name: ChatLog
descriptipn: Chatlog generator to report players
version: 1.13.6
version: 1.14.1
api-version: 1.13
author: McLive
website: www.freecraft.eu

main: eu.mclive.ChatLog.ChatLog

commands:
chatreport:
aliases: [chatlog]
chatlog:
aliases:
- chatreport
description: Generate a chatlog to report players

permissions:
chatlog.command:
description: Allows /chatreport
description: Allows /chatlog

chatlog.reload:
description: Allows reloading the plugin with /chatlog reload
3 changes: 2 additions & 1 deletion src/eu/mclive/ChatLog/AsyncChatListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public void onAsyncPlayerChat(final AsyncPlayerChatEvent e) {
if (e.isCancelled()) {
return;
}
plugin.getUtils().logMessage(e.getPlayer(), e.getMessage());
String worldName = e.getPlayer().getWorld().getName();
plugin.getUtils().logMessage(e.getPlayer(), worldName, e.getMessage());
}
}
3 changes: 2 additions & 1 deletion src/eu/mclive/ChatLog/ChatListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public void onPlayerChat(final PlayerChatEvent e) {
if (e.isCancelled()) {
return;
}
plugin.getUtils().logMessage(e.getPlayer(), e.getMessage());
String worldName = e.getPlayer().getWorld().getName();
plugin.getUtils().logMessage(e.getPlayer(), worldName, e.getMessage());
}
}
32 changes: 15 additions & 17 deletions src/eu/mclive/ChatLog/ChatLog.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package eu.mclive.ChatLog;

import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
import java.util.concurrent.Callable;
import java.util.logging.Logger;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;

import eu.mclive.ChatLog.Commands.Chatreport;
import eu.mclive.ChatLog.Commands.Chatlog;
import eu.mclive.ChatLog.MySQL.MySQL;
import eu.mclive.ChatLog.MySQL.MySQLHandler;
import eu.mclive.ChatLog.update.UpdateListener;
Expand All @@ -20,21 +20,16 @@
public class ChatLog extends JavaPlugin implements Listener {

public UUIDHandler UUIDHandler;
public Logger logger = getLogger();
public MySQL sql;
public Messages messages;
public MySQLHandler sqlHandler;
public Long pluginstart = null;
private eu.mclive.ChatLog.bstats.Metrics bstats;
private Utils utils;

/**
* Issued ChatLogs since last submit.
*/
private int issuedChatLogs = 0;

/**
* Logged Messages since last submit.
*/
private int loggedMessages = 0;

public void onEnable() {
Expand Down Expand Up @@ -68,15 +63,18 @@ public void onEnable() {
Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_GREEN + "[ChatLog] " + ChatColor.RED + "Failed to load bStats.");
}
}

UpdateUtil.scheduleUpdateChecker(this);
this.cleanup();

this.registerEvents();
this.registerCommands();
this.checkUpdates();

Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_GREEN + "[ChatLog] " + ChatColor.GREEN + "Plugin started.");
}
boolean performUpdateCheck = getConfig().getBoolean("update-check");
if (performUpdateCheck) {
Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_GREEN + "[ChatLog] " + ChatColor.YELLOW + "Checking for updates...");
UpdateUtil.checkForUpdates(this);
}

Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_GREEN + "[ChatLog] " + ChatColor.GREEN + "Plugin started.");
}

public void onDisable() {
if (sql != null) {
Expand All @@ -91,7 +89,7 @@ private void setupConfig() {
}

private void registerCommands() {
getCommand("chatreport").setExecutor(new Chatreport(this));
getCommand("chatlog").setExecutor(new Chatlog(this));
}

private void registerEvents() {
Expand Down Expand Up @@ -141,9 +139,9 @@ public void run() {
String server = getConfig().getString("Server-Name");
String bypassCharacter = getConfig().getString("bypass-character");
String bypassPermission = getConfig().getString("bypass-permission");
//System.out.println(server + p + msg + timestamp);
String worldName = p.getWorld().getName();
if (bypassCharacter.isEmpty() || (msg.startsWith(bypassCharacter) && !p.hasPermission(bypassPermission)) || !msg.startsWith(bypassCharacter)) {
sqlHandler.addMessage(server, p, msg, timestamp);
sqlHandler.addMessage(server, p, msg, timestamp, worldName);
}
}
});
Expand Down
Loading