Skip to content

Commit

Permalink
check if single player
Browse files Browse the repository at this point in the history
  • Loading branch information
hashblen committed Feb 28, 2022
1 parent 674039e commit 26ad54d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/main/java/com/hashblen/macromod/CSVManip.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/com/hashblen/macromod/MacroMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.util.ChatComponentText;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
Expand Down Expand Up @@ -37,6 +38,7 @@ public class MacroMod
public static Minecraft mc = Minecraft.getMinecraft();
public static String path = "";
public static String macroName = "default.csv";
public static boolean srv = false;
private List<MacroLine> lineList;

@EventHandler
Expand All @@ -55,6 +57,8 @@ public void preInit(FMLPreInitializationEvent event){
System.err.println("Last Name didn't end with .csv, so changed the name to: " + macroName);
}

Property mSrv = config.get("Test", "srv", false);
srv = mSrv.getBoolean();

try {
Files.createDirectories(p);
Expand Down Expand Up @@ -136,6 +140,9 @@ private void endMacro(){

@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent e){
if(!srv && !mc.isSingleplayer()){
return;
}
if(lineList.isEmpty()) {
return;
}
Expand All @@ -156,6 +163,10 @@ public void onKey(InputEvent.KeyInputEvent e){
mc.displayGuiScreen(new MenuGUI());
}
if(start.isPressed()){
if(!srv && !mc.isSingleplayer()){
mc.thePlayer.addChatMessage(new ChatComponentText("The \247cMacroMod \247r\247ncan't\247r be used on servers. Contact if you need a special permission."));
return;
}
loadLines();
if(isRunning){
endMacro();
Expand Down

0 comments on commit 26ad54d

Please sign in to comment.