Skip to content

Commit

Permalink
修复 Listener 未注册的 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ChloePrime committed Dec 10, 2021
1 parent f50bfac commit 9010732
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

version = '1.1.4'
version = '1.2.3'
group = 'chloeprime.fix4log4j' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'Fix4Log4J'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import chloeprime.fix4log4j.Fixer;
import org.apache.logging.log4j.LogManager;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
Expand All @@ -25,10 +26,12 @@ public void onLoad() {
public void onEnable() {
super.onEnable();
Fixer.doRuntimeTest(LogManager.getLogger("Fix4Log4J"));
doCensor = getConfig().getBoolean("censor-user-input");

doCensor = getConfig().getBoolean("censor-user-input", true);
getServer().getPluginManager().registerEvents(this, this);
}

@EventHandler
@EventHandler(priority = EventPriority.LOWEST)
public void censorCommand(PlayerCommandPreprocessEvent event) {
if (!doCensor) {
return;
Expand All @@ -39,7 +42,7 @@ public void censorCommand(PlayerCommandPreprocessEvent event) {
}
}

@EventHandler
@EventHandler(priority = EventPriority.LOWEST)
public void censorChatAsync(AsyncPlayerChatEvent event) {
if (!doCensor) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/chloeprime/fix4log4j/forge/Fix4Log4JMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
public class Fix4Log4JMod {
public static final String MODID = "fix4log4j";
public static final String NAME = "Fix4Log4J";
public static final String VERSION = "1.1.4";
public static final String VERSION = "1.2.3";

@EventHandler
public void construct(FMLConstructionEvent event) {
Expand Down

0 comments on commit 9010732

Please sign in to comment.