Skip to content

Commit

Permalink
MultiLineInputBox (script editor 1) and some additional changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tanishisherewithhh committed Mar 10, 2024
1 parent 9f35d4a commit 63c8b5c
Show file tree
Hide file tree
Showing 5 changed files with 878 additions and 3 deletions.
4 changes: 2 additions & 2 deletions examples/itemframedupe.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local breakDelaytimer = 0

local function setFullBrightModuleOn()
local function doItemFrameDupe()
-- Check if the player is holding an item frame, if yes then dont continue the dupe.
if mc.player:getMainHandStack():getItem() == Items.ITEM_FRAME then
return
Expand Down Expand Up @@ -53,7 +53,7 @@ end


function onTick()
return setFullBrightModuleOn()
return doItemFrameDupe()
end

function onStop()
Expand Down
28 changes: 28 additions & 0 deletions src/main/java/dev/heliosclient/scripting/LuaFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ public boolean isLoaded() {
public Reader getReader() throws FileNotFoundException {
return new BufferedReader(new FileReader(this));
}
/**
* Retrieves a Buffered reader for the Lua script file.
*
* @return A reader for the Lua script file.
* @throws FileNotFoundException If the Lua script file does not exist.
*/
public BufferedReader getBufferedReader() throws FileNotFoundException {
return new BufferedReader(new FileReader(this));
}

public File getFile() {
return this;
Expand Down Expand Up @@ -74,4 +83,23 @@ public void setListening(boolean isListeningForBind) {
public LuaExecutor getExecutor() {
return executor;
}


/**
* Retrieves the text inside the Lua script file.
*
* @return The text inside the Lua script file.
* @throws IOException If an I/O error occurs.
*/
public String getText() throws IOException {
StringBuilder text = new StringBuilder();
try (BufferedReader reader = getBufferedReader()) {
String line;
while ((line = reader.readLine()) != null) {
text.append(line);
text.append('\n');
}
}
return text.toString();
}
}
Loading

0 comments on commit 63c8b5c

Please sign in to comment.