Thanks for 50+ downloads!
This plugin allows you to create signs with free items.
You have to create a sign like this:
Line 1: [FreeSigns] (set as default)
Line 2: ID:SubID (e.g. 5:1 for Spruce wood planks)
Line 3: Amount (e.g 64 for a stack)
Line 4: Your text/description (e.g &aSprucewood -> Will be displayed in green)
You can find any ID's here . Color codes can be found here .
If you have any requests, ideas or found any bugs, please let me know it!
Don't forget to check out my other awsome plugins !
This plugin allows you to create signs with free items.
You have to create a sign like this:
Line 1: [FreeSigns] (set as default)
Line 2: ID:SubID (e.g. 5:1 for Spruce wood planks)
Line 3: Amount (e.g 64 for a stack)
Line 4: Your text/description (e.g &aSprucewood -> Will be displayed in green)
You can find any ID's here . Color codes can be found here .
Spoiler: Permissions
freesigns.create-> Allows you to create freesigns
Spoiler: Code
Spoiler: Main.java
Code (Text):
package mr.minecraft15.FreeSigns;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.BlockState;
import org.bukkit.block.Sign;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin implements Listener {
private static String prefix = "§7[§bFreeSigns§7] ";
private static String signprefix;
private static String signcreateprefix;
private static int seconds;
private static boolean delay;
private static boolean sound;
public void onEnable() {
FileConfiguration cfg = getConfig();
cfg.options().copyDefaults(true);
cfg.addDefault("Sign.prefix", "&bFreeSigns");
cfg.addDefault("Sign.createprefix", "[freeSigns]");
cfg.addDefault("Sign.playsound", true);
cfg.addDefault("Delay.use", true);
cfg.addDefault("Delay.seconds", 60);
saveConfig();
signprefix = ChatColor.translateAlternateColorCodes('&', cfg.getString("Sign.prefix"));
signcreateprefix = cfg.getString("Sign.createprefix");
sound = cfg.getBoolean("Sign.playsound");
delay = cfg.getBoolean("Delay.use");
seconds = cfg.getInt("Delay.seconds");
Bukkit.getPluginManager().registerEvents(this, this);
}
@EventHandler
private void onChangeSign(SignChangeEvent e) {
Player p = e.getPlayer();
if(e.getLine(0).equalsIgnoreCase(signcreateprefix) && p.hasPermission("freesigns.create")) {
e.setLine(0, signprefix);
e.setLine(3, e.getLine(3).replace("&","§"));
p.sendMessage(prefix + "FreeSign successfully created.");
}
}
@SuppressWarnings("deprecation")
@EventHandler
private void onInteractWithSign(PlayerInteractEvent e) {
final Player p = e.getPlayer();
if(e.getAction() == Action.RIGHT_CLICK_BLOCK) {
BlockState bs = e.getClickedBlock().getState();
if(bs instanceof Sign) {
Sign sign = (Sign)bs;
String line0 = sign.getLine(0);
String line1 = sign.getLine(1);
String line2 = sign.getLine(2);
String line3 = sign.getLine(3);
if(line0.equals(signprefix)) {
if(delay) {
String key = p.getName() + ":" + line1;
if(Delays.haveToWait(key, seconds)) {
p.sendMessage(Main.prefix + "You have to wait " + Delays.getRemainingTime(key, seconds) + ".");
return;
}
Delays.registerDelay(key);
}
try {
line1 = line1.replace("§0", "");
int id = 0;
int subid = 0;
if(line1.contains(":")) {
String[] parts = line1.split(":");
id = Integer.parseInt(parts[0]);
subid = Integer.parseInt(parts[1]);
} else {
id = Integer.parseInt(line1);
}
int amount = Integer.parseInt(line2.replace("§0", ""));
if(sound) {
p.playSound(p.getLocation(), Sound.LEVEL_UP, 1, 1);
}
Inventory i = Bukkit.createInventory(p, 9, line3);
i.setItem(4, new ItemStack(Material.getMaterial(id), amount, (short)subid));
p.openInventory(i);
} catch (NumberFormatException ex) {
p.sendMessage(prefix + "Invalid FreeSign.");
}
}
}
}
}
}
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.BlockState;
import org.bukkit.block.Sign;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin implements Listener {
private static String prefix = "§7[§bFreeSigns§7] ";
private static String signprefix;
private static String signcreateprefix;
private static int seconds;
private static boolean delay;
private static boolean sound;
public void onEnable() {
FileConfiguration cfg = getConfig();
cfg.options().copyDefaults(true);
cfg.addDefault("Sign.prefix", "&bFreeSigns");
cfg.addDefault("Sign.createprefix", "[freeSigns]");
cfg.addDefault("Sign.playsound", true);
cfg.addDefault("Delay.use", true);
cfg.addDefault("Delay.seconds", 60);
saveConfig();
signprefix = ChatColor.translateAlternateColorCodes('&', cfg.getString("Sign.prefix"));
signcreateprefix = cfg.getString("Sign.createprefix");
sound = cfg.getBoolean("Sign.playsound");
delay = cfg.getBoolean("Delay.use");
seconds = cfg.getInt("Delay.seconds");
Bukkit.getPluginManager().registerEvents(this, this);
}
@EventHandler
private void onChangeSign(SignChangeEvent e) {
Player p = e.getPlayer();
if(e.getLine(0).equalsIgnoreCase(signcreateprefix) && p.hasPermission("freesigns.create")) {
e.setLine(0, signprefix);
e.setLine(3, e.getLine(3).replace("&","§"));
p.sendMessage(prefix + "FreeSign successfully created.");
}
}
@SuppressWarnings("deprecation")
@EventHandler
private void onInteractWithSign(PlayerInteractEvent e) {
final Player p = e.getPlayer();
if(e.getAction() == Action.RIGHT_CLICK_BLOCK) {
BlockState bs = e.getClickedBlock().getState();
if(bs instanceof Sign) {
Sign sign = (Sign)bs;
String line0 = sign.getLine(0);
String line1 = sign.getLine(1);
String line2 = sign.getLine(2);
String line3 = sign.getLine(3);
if(line0.equals(signprefix)) {
if(delay) {
String key = p.getName() + ":" + line1;
if(Delays.haveToWait(key, seconds)) {
p.sendMessage(Main.prefix + "You have to wait " + Delays.getRemainingTime(key, seconds) + ".");
return;
}
Delays.registerDelay(key);
}
try {
line1 = line1.replace("§0", "");
int id = 0;
int subid = 0;
if(line1.contains(":")) {
String[] parts = line1.split(":");
id = Integer.parseInt(parts[0]);
subid = Integer.parseInt(parts[1]);
} else {
id = Integer.parseInt(line1);
}
int amount = Integer.parseInt(line2.replace("§0", ""));
if(sound) {
p.playSound(p.getLocation(), Sound.LEVEL_UP, 1, 1);
}
Inventory i = Bukkit.createInventory(p, 9, line3);
i.setItem(4, new ItemStack(Material.getMaterial(id), amount, (short)subid));
p.openInventory(i);
} catch (NumberFormatException ex) {
p.sendMessage(prefix + "Invalid FreeSign.");
}
}
}
}
}
}
Spoiler: Delays.java
Code (Text):
package mr.minecraft15.FreeSigns;
import java.util.HashMap;
public class Delays {
public static HashMap<String, Long> delays = new HashMap<String, Long>();
public static void registerDelay(String key) {
delays.put(key, System.currentTimeMillis());
}
public static boolean haveToWait(String key, int seconds) {
if(Delays.delays.containsKey(key)) {
if((System.currentTimeMillis() - Delays.delays.get(key)) / 1000 >= seconds) {
Delays.delays.remove(key);
}
}
return Delays.delays.containsKey(key);
}
public static String getRemainingTime(String key, int seconds) {
return getTime(seconds - (System.currentTimeMillis() - Delays.delays.get(key)) / 1000);
}
public static String getTime(long seconds) {
int sec = 0, min = 0, h = 0, d = 0, w = 0, m = 0, y = 0;
for(int i = 0; i < seconds; ++i) {
++sec;
if(sec >= 60) {
min++; sec = 0;
}
if(min >= 60) {
h++; min = 0;
}
if(h >= 24) {
d++; h = 0;
}
if(d >= 7) {
w++; d = 0;
}
if(w >= 4) {
m++; w = 0;
}
if(m >= 12) {
y++; m = 0;
}
}
String secStr = (sec != 0) ? sec + " second" + ((sec == 1) ? "" : "s") : null, minStr = (min != 0) ? min + " minute" + ((min == 1) ? "" : "s") : null, hStr = (h != 0) ? h + " hour" + ((h == 1) ? "" : "s") : null, dStr = (d != 0) ? d + " day" + ((d == 1) ? "" : "s") : null, wStr = (w != 0) ? w + " week" + ((w == 1) ? "" : "s") : null, mStr = (m != 0) ? m + " month" + ((m == 1) ? "" : "s") : null, yStr = (y != 0) ? y + " year" + ((y == 1) ? "" : "s") : null;
String r = (yStr == null ? "" : yStr + " ") + (mStr == null ? "" : mStr + " ") + (wStr == null ? "" : wStr + " ") + (dStr == null ? "" : dStr + " ") + (hStr == null ? "" : hStr + " ") + (minStr == null ? "" : minStr + " ") + (secStr == null ? "" : secStr + " ");
return r.substring(0, r.length() - 1);
}
}
import java.util.HashMap;
public class Delays {
public static HashMap<String, Long> delays = new HashMap<String, Long>();
public static void registerDelay(String key) {
delays.put(key, System.currentTimeMillis());
}
public static boolean haveToWait(String key, int seconds) {
if(Delays.delays.containsKey(key)) {
if((System.currentTimeMillis() - Delays.delays.get(key)) / 1000 >= seconds) {
Delays.delays.remove(key);
}
}
return Delays.delays.containsKey(key);
}
public static String getRemainingTime(String key, int seconds) {
return getTime(seconds - (System.currentTimeMillis() - Delays.delays.get(key)) / 1000);
}
public static String getTime(long seconds) {
int sec = 0, min = 0, h = 0, d = 0, w = 0, m = 0, y = 0;
for(int i = 0; i < seconds; ++i) {
++sec;
if(sec >= 60) {
min++; sec = 0;
}
if(min >= 60) {
h++; min = 0;
}
if(h >= 24) {
d++; h = 0;
}
if(d >= 7) {
w++; d = 0;
}
if(w >= 4) {
m++; w = 0;
}
if(m >= 12) {
y++; m = 0;
}
}
String secStr = (sec != 0) ? sec + " second" + ((sec == 1) ? "" : "s") : null, minStr = (min != 0) ? min + " minute" + ((min == 1) ? "" : "s") : null, hStr = (h != 0) ? h + " hour" + ((h == 1) ? "" : "s") : null, dStr = (d != 0) ? d + " day" + ((d == 1) ? "" : "s") : null, wStr = (w != 0) ? w + " week" + ((w == 1) ? "" : "s") : null, mStr = (m != 0) ? m + " month" + ((m == 1) ? "" : "s") : null, yStr = (y != 0) ? y + " year" + ((y == 1) ? "" : "s") : null;
String r = (yStr == null ? "" : yStr + " ") + (mStr == null ? "" : mStr + " ") + (wStr == null ? "" : wStr + " ") + (dStr == null ? "" : dStr + " ") + (hStr == null ? "" : hStr + " ") + (minStr == null ? "" : minStr + " ") + (secStr == null ? "" : secStr + " ");
return r.substring(0, r.length() - 1);
}
}
If you have any requests, ideas or found any bugs, please let me know it!
Don't forget to check out my other awsome plugins !
Quick facts
- Edition: Minecraft Java
- File type: .jar
- How to install: Install the matching mod loader (Forge, Fabric or NeoForge) for your Minecraft version. → Download the .jar. → Put it in the .minecraft/mods folder and launch that loader profile.
- Where to get it: Opens on Spigot — not every file is mirrored on our own servers.
Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.
FreeSigns is a free Minecraft Java mod. Downloaded 610 times (via Spigot). Download it and open it directly in the game.