-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #153 from LandOfRails/feature/issue-151-rail-switc…
…h-always-points-left-from-either-perspective Feature/issue 151 rail switch always points left from either perspective
- Loading branch information
Showing
60 changed files
with
11,150 additions
and
2,108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.3.1 | ||
1.3.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 0 additions & 27 deletions
27
src/main/java/net/landofrails/landofsignals/commands/ConfigCommand.java
This file was deleted.
Oops, something went wrong.
31 changes: 0 additions & 31 deletions
31
src/main/java/net/landofrails/landofsignals/commands/DebugCommand.java
This file was deleted.
Oops, something went wrong.
142 changes: 142 additions & 0 deletions
142
src/main/java/net/landofrails/landofsignals/commands/LandOfSignalsCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
package net.landofrails.landofsignals.commands; | ||
|
||
import cam72cam.mod.entity.Player; | ||
import cam72cam.mod.text.Command; | ||
import cam72cam.mod.text.PlayerMessage; | ||
import net.landofrails.api.contentpacks.GenericContentPack; | ||
import net.landofrails.landofsignals.LandOfSignals; | ||
import net.landofrails.landofsignals.configs.LandOfSignalsConfig; | ||
import net.landofrails.landofsignals.contentpacks.ContentPackHandler; | ||
import net.landofrails.landofsignals.packet.CommandClientPacket; | ||
|
||
import java.io.File; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
import java.util.function.Consumer; | ||
|
||
public class LandOfSignalsCommand extends Command { | ||
@Override | ||
public String getPrefix() { | ||
return "landofsignals"; | ||
} | ||
|
||
@Override | ||
public String getUsage() { | ||
return "Usage: /landofsignals help"; | ||
} | ||
|
||
/** | ||
* | ||
* landofsignals command (will only be executed server-side) | ||
* | ||
* @param sender | ||
* @param player | ||
* @param args | ||
* @return | ||
*/ | ||
@Override | ||
public boolean execute(final Consumer<PlayerMessage> sender, final Optional<Player> player, final String[] args) { | ||
|
||
String arg0 = args.length > 0 ? args[0].toUpperCase() : ""; | ||
|
||
// HELP | ||
// DEBUG | ||
// LOS-CONFIG | ||
// CONFIGFOLDER | ||
|
||
switch (arg0){ | ||
case "HELP": | ||
case "?": | ||
return help(sender); | ||
case "DEBUGINFO": | ||
case "DEBUG": | ||
return debug(sender, player); | ||
case "LOS-CONFIG": | ||
case "CONFIG": | ||
return losConfig(sender, player); | ||
case "CONFIGFOLDER": | ||
case "FOLDER": | ||
return configFolder(sender, player); | ||
default: | ||
return false; | ||
} | ||
} | ||
|
||
|
||
private boolean help(final Consumer<PlayerMessage> sender){ | ||
Consumer<String> send = msg -> sender.accept(PlayerMessage.direct(msg)); | ||
String text = " ->- Help for /landofsignals (page 1/1) -<-" + | ||
"\n/landofsignals help : Shows the available commands" + | ||
"\n/landofsignals debug : Shows debug information for client and/or server" + | ||
"\n/landofsignals los-config : Opens config GUI (needs a restart to take effect)" + | ||
"\n/landofsignals configfolder : Opens/Returns the config folder (where contentpacks can be placed in)" + | ||
"\n/landofsignals contentpacks [load <contentpack] : >> NOT AVAILABLE YET << Loads contentpacks while ingame (only client-side)" + | ||
"\n ->- Help for /landofsignals (page 1/1) -<-"; | ||
for(String line : text.split("\\n")) | ||
send.accept(line); | ||
return true; | ||
} | ||
|
||
private boolean debug(final Consumer<PlayerMessage> sender, final Optional<Player> player) { | ||
|
||
Consumer<String> send = msg -> sender.accept(PlayerMessage.direct(msg)); | ||
|
||
// Server | ||
send.accept("Server report:"); | ||
send.accept("Version: " + LandOfSignals.VERSION); | ||
send.accept("Settings: "); | ||
for(Map.Entry<String, Object> conf : LandOfSignalsConfig.values().entrySet()) | ||
send.accept(" - " + conf.getKey() + ": " + conf.getValue().toString()); | ||
send.accept("Detected contentpacks: "); | ||
for(Map.Entry<GenericContentPack, Map.Entry<Boolean, String>> gcp : ContentPackHandler.getContentpackHeaders().entrySet()) { | ||
send.accept(" - " + gcp.getKey().toShortString()); | ||
send.accept(" * UTF8: " + gcp.getValue().getKey() + "; Status: " + gcp.getValue().getValue()); | ||
} | ||
|
||
// Client | ||
player.ifPresent(value -> new CommandClientPacket(CommandClientPacket.Command.DEBUG).sendToPlayer(value)); | ||
|
||
return false; | ||
} | ||
|
||
private boolean losConfig(final Consumer<PlayerMessage> sender, final Optional<Player> optionalPlayer) { | ||
if(optionalPlayer.isPresent()){ | ||
new CommandClientPacket(CommandClientPacket.Command.CONFIG).sendToPlayer(optionalPlayer.get()); | ||
} else { | ||
sender.accept(PlayerMessage.direct("This command is only available for players!")); | ||
} | ||
return true; | ||
} | ||
|
||
private boolean configFolder(final Consumer<PlayerMessage> sender, final Optional<Player> optionalPlayer) { | ||
|
||
if(optionalPlayer.isPresent()){ | ||
new CommandClientPacket(CommandClientPacket.Command.FOLDER).sendToPlayer(optionalPlayer.get()); | ||
return true; | ||
} | ||
|
||
final File assetFolder = new File("./config/landofsignals"); | ||
final String assetUrl = "file://" + assetFolder.getAbsolutePath(); | ||
|
||
boolean success = true; | ||
if (!assetFolder.exists()) { | ||
success = assetFolder.mkdirs(); | ||
} | ||
|
||
if(!success){ | ||
sender.accept(PlayerMessage.direct("Couldn't create folder! Target:")); | ||
sender.accept(PlayerMessage.url(assetUrl)); | ||
return true; | ||
} | ||
|
||
sender.accept(PlayerMessage.direct("Can't open the folder, but you can find it here:")); | ||
sender.accept(PlayerMessage.url(assetUrl)); | ||
|
||
return true; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.