Last active
January 1, 2016 17:09
-
-
Save jhuckaby/8175404 to your computer and use it in GitHub Desktop.
Minecraft Bukkit ScriptCraft extension for setting sign text on already placed signs. Usage: /js setsigntext(X, Y, Z, ["Hello", "There", "Line 3", "Line 4"]); Install to the ScriptCraft drone/contrib/ folder and restart the server, or type /js refresh(); to reload.
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
/* Set sign text on an already placed sign. */ | |
/* Specify sign block coordinates and array of strings. */ | |
/* This will currently only work on the main overworld on a server. */ | |
/* Usage: /js setsigntext(-847, 63, 107, ["Hello", "There"]); */ | |
/* Author: Joseph Huckaby, December 29, 2013 */ | |
/* License: Public Domain */ | |
// For ScriptCraft 1.7, uncomment this, I think: | |
// var Drone = require('../drone').Drone; | |
Drone.extend("setsigntext", function(x, y, z, texts) { | |
var world = server.worlds.get(0); | |
var block = world.getBlockAt(x,y,z); | |
var state = block.state; | |
if (state instanceof org.bukkit.block.Sign){ | |
for (var i = 0;i < texts.length; i++) | |
state.setLine(i%4,texts[i]); | |
state.update(true); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment