Refactor
All checks were successful
/ build (push) Successful in 10m54s

Signed-off-by: Minecon724 <minecon724@noreply.git.m724.eu>
This commit is contained in:
Minecon724 2025-05-17 10:18:58 +02:00
commit e67c187f4e
Signed by: Minecon724
GPG key ID: A02E6E67AB961189
3 changed files with 11 additions and 15 deletions

View file

@ -92,7 +92,7 @@ Adds a "gateway" item that are controlled over internet. \
Control knockback dealt by entities
### Kill switch
Quickly kills (terminates) the server on trigger, via command or HTTP request.
Quickly kills (terminates) the server on trigger, by command or HTTP request.
[KILLSWITCH.md for more info](/Minecon724/tweaks724/src/branch/master/docs/KILLSWITCH.md)
### Swing through grass
@ -101,12 +101,10 @@ Self-explanatory
### Durability alert
Self-explanatory too.
`/durabilityalert` (`tweaks724.durabilityalert`)
### WordCoords
Converts coords to words and back so you easily remember them.
### Word coords
Convert coordinates to easier to remember words
`/wordcoords` (`tweaks724.tauth`)
`/wordcoords` (`tweaks724.wordcoords`)
### Utility commands

View file

@ -34,6 +34,7 @@ import java.util.NoSuchElementException;
public class WordCoordsModule extends TweaksModule implements CommandExecutor, Listener {
private static final int MAX_RADIUS = 30_000_000;
private WordList wordList;
private WordCoordsCodec converter;
@Override
@ -48,14 +49,13 @@ public class WordCoordsModule extends TweaksModule implements CommandExecutor, L
}
}
WordList wordList;
try {
wordList = WordList.fromFile(wordListFile);
this.wordList = WordList.fromFile(wordListFile);
} catch (IOException e) {
throw new RuntimeException("Failed to load word list", e);
}
this.converter = new WordCoordsCodec(wordList);
this.converter = new WordCoordsCodec(this.wordList);
registerCommand("wordcoords", this);
registerEvents(this);
@ -171,11 +171,10 @@ public class WordCoordsModule extends TweaksModule implements CommandExecutor, L
}
@EventHandler
public void onCommand(PlayerCommandPreprocessEvent event) {
if (event.getMessage().startsWith("///")) {
event.setCancelled(true);
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
if (!event.getMessage().startsWith("///")) return;
event.getPlayer().performCommand("wordcoords " + event.getMessage().substring(3));
}
event.getPlayer().performCommand("wordcoords " + event.getMessage().substring(3));
event.setCancelled(true);
}
}

View file

@ -58,6 +58,5 @@ public class WordList {
return new WordList(list);
}
}
}