Fixed gamemode commands in 1.19

This commit is contained in:
Harry Zhou 2022-06-10 00:09:21 -05:00
parent 2f5612aa05
commit c29c886095
3 changed files with 10 additions and 4 deletions

View file

@ -337,7 +337,10 @@ public class CommandProcessor {
public boolean processCommand(String args) {
if (args.length() > 0) {
SongPlayer.creativeCommand = args;
SongPlayer.addChatMessage("§6Set creative command to " + SongPlayer.creativeCommand);
if (SongPlayer.creativeCommand.startsWith("/")) {
SongPlayer.creativeCommand = SongPlayer.creativeCommand.substring(1);
}
SongPlayer.addChatMessage("§6Set creative command to /" + SongPlayer.creativeCommand);
return true;
}
else {
@ -359,7 +362,10 @@ public class CommandProcessor {
public boolean processCommand(String args) {
if (args.length() > 0) {
SongPlayer.survivalCommand = args;
SongPlayer.addChatMessage("§6Set survival command to " + SongPlayer.survivalCommand);
if (SongPlayer.survivalCommand.startsWith("/")) {
SongPlayer.survivalCommand = SongPlayer.survivalCommand.substring(1);
}
SongPlayer.addChatMessage("§6Set survival command to /" + SongPlayer.survivalCommand);
return true;
}
else {

View file

@ -75,7 +75,7 @@ public class BuildingThread extends Thread {
}
}
player.sendChatMessage(SongPlayer.creativeCommand);
player.sendCommand(SongPlayer.creativeCommand);
try { //delay in case of block updates
Thread.sleep(1000);
} catch (InterruptedException e) {

View file

@ -14,7 +14,7 @@ public class PlayingThread extends Thread{
private final Song song = SongPlayer.song;
public void run() {
player.sendChatMessage(SongPlayer.survivalCommand);
player.sendCommand(SongPlayer.survivalCommand);
while (SongPlayer.MC.interactionManager.getCurrentGameMode() != GameMode.SURVIVAL) {
if (SongPlayer.mode != SongPlayer.Mode.PLAYING) {return;}
try {