Skip to content

Commit

Permalink
Fix plugin initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
4drian3d committed Oct 7, 2021
1 parent 10c7109 commit 9625cfd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>net.dreamerzero.chatregulator</groupId>
<artifactId>ChatRegulator</artifactId>
<version>1.2.0</version>
<version>1.2.1</version>
<packaging>jar</packaging>

<properties>
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/net/dreamerzero/chatregulator/Regulator.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ public void onProxyInitialization(final ProxyInitializeEvent event) {
MiniMessage.miniMessage().parse("<gradient:#f2709c:#ff9472>ChatRegulator</gradient> <gradient:#DAE2F8:#D4D3DD>has started, have a very nice day</gradient>"));
// Default config
new Configuration(config, blacklist).setDefaultConfig();

server.getEventManager().register(this, new PluginListener(logger));
if(server.getPluginManager().isLoaded("ServerUtils")){
server.getEventManager().register(this, new PluginListener(logger));
}
server.getEventManager().register(this, new ChatListener(server, logger, config, blacklist));
server.getEventManager().register(this, new CommandListener(server, logger, config, blacklist));
server.getEventManager().register(this, new JoinListener(infractionPlayers));
Expand Down Expand Up @@ -99,7 +100,7 @@ void checkInfractionPlayersRunnable(){
for(Entry<UUID, InfractionPlayer> entry : infractionPlayers.entrySet()){
InfractionPlayer iPlayer = entry.getValue();
if(iPlayer.isOnline()) continue;
if(entry.getValue().getLastSeen() - System.currentTimeMillis() > timeToDelete){
if(iPlayer.getLastSeen() - System.currentTimeMillis() > timeToDelete){
infractionPlayers.remove(entry.getKey());
if(config.getBoolean("general.debug")) {
logger.info("The player {} was eliminated", iPlayer.username());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void setDefaultConfig(){
"<red>Hello, it is not allowed to make flood on this server.");
config.setDefault(
"flood.messages.alert",
"<red>The player <aqua><player></aqua> <red>has make flood <aqua><server></aqua> server.");
"<red>The player <aqua><player></aqua> <red>has make flood in <aqua><server></aqua> server.");
config.setDefault(
"flood.messages.reset",
"<red>The flood warning count for <player> was reset.");
Expand All @@ -87,13 +87,13 @@ public void setDefaultConfig(){
"message");
config.setDefault(
"spam.messages.warning",
"<red>Hello, it is not allowed to make flood on this server.");
"<red>Hello, it is not allowed to make spam on this server.");
config.setDefault(
"spam.messages.reset",
"<red>The spam warning count for <player> was reset.");
config.setDefault(
"spam.messages.alert",
"<red>The player <aqua><player></aqua> <red>has make flood <aqua><server></aqua> server.");
"<red>The player <aqua><player></aqua> <red>was spamming the chat in <aqua><server></aqua> server.");
config.setDefault("spam.commands.execute-commands", false);
config.setDefault("spam.commands.violations-required", 5);
config.setDefault(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ public enum SourceType{
*/
public boolean isCommand(String command){
List<String> commandsChecked = config.getStringList("commands-checked");
String commandParts[] = command.split(" ");
String commandExecuted = command.split(" ")[0];

for (String commandChecked : commandsChecked) {
if (commandParts[0].contains(commandChecked)) {
if (commandExecuted.contains(commandChecked)) {
return true;
}
}
Expand Down

0 comments on commit 9625cfd

Please sign in to comment.