Sueta

Fredashay's Villager Chat

2023-11-11

This plugin causes your villagers to spout random gibberish throughout the day.

·Plugin
  1. 2023-11-11latestUpdated for 1.20Nov 11, 2023
    Updated for Minecraft 1.20.
    5 downloads
  2. 3.0Recompiled for 1.16Dec 19, 2020
    Recompiled for 1.16 Also gave names to the villagers rather than numbers. It generates the names randomly: consonant-vowel-consonant-vowel-consonant.
    104 downloads
  3. 2017-10-27requested new featureOct 28, 2017
    Someone requested that the plugin create a sample villager chat .TXT file if one doesn't exist. So the first time you run the plugin, it will create a sample file "FredashaySpigotVillagerChat.txt" (if it doesn't exist) containing several sample villager chat messages. As I said once before, each line of text is a separate villager chat post. Don't spread a villager chat post across two lines or put line break within a villager chat post, or the plugin will see it as separate chat posts. Also, edit the TXT file only with a text editor like Notepad or VI. Don't use a word processor like MS Word or Wordpad, as these will put hidden meta characters in the file that will confuse the plugin.
    113 downloads
  4. 2017-09-30general improvementsSep 30, 2017
    This plugin causes your villagers to spout random gibberish throughout the day. You can have your villagers tell jokes, or if you're politically inclined have them spew left-wing or right-wing propaganda, or Bible quotes if you're running a religious server, or movie quotes, or adverts if your server is part of a business, or automotive advice, or whatever else warps your starship... You can change various settings in the properties file to vary the frequency of the villager chats and add a random factor. To install this plugin, copy the plugin JAR file to your server's plugins folder. Then create a text file with Notepad or VI in the home directory of your server (where all the .PROPERTIES files and such are) named "FredashayVillagerChat.txt". Fill this file with the things you want your villagers to say. Remember, each line break will create a new thing for a different villager, so don't break a single statement with a line break, but make sure there are line breaks between each villager's statements. I currently run a Rainbow server, but I want greater functionality than the Rainbow API provides, so I've been learning Spigot. This is the first of several of my Rainbow plugins that I rewrote for Spigot. Code (Text): package FredashaySpigotVillagerChat; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.sql.Date; import java.text.SimpleDateFormat; import java.util.Properties; import java.util.Random; import java.util.logging.Logger; import org.bukkit.ChatColor; import org.bukkit.command.CommandExecutor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.java.JavaPlugin; public class MyPlugin extends JavaPlugin implements Listener, CommandExecutor { private static Logger logger = null; private static PluginDescriptionFile pdfFile = null; private static Properties props = new Properties(); final static int MAX_GIBBERISH = 1000; private static String gibberishFileName = null; private static String propertiesFileName = null; private static String[] gibberish = new String[MAX_GIBBERISH]; private static int countGibberish = 0; private static boolean gibbering = false; private static long nextTime = 0; private static String lastPlayerName = " "; private static int frequency = 60; private static int afterJoin = 2; private static int giveOrTake = 10; private static ChatColor nameColor = ChatColor.RESET; @Override public void onEnable() { logger = Logger.getLogger("Minecraft"); pdfFile = getDescription(); getServer().getPluginManager().registerEvents(this, this); propertiesFileName = pdfFile.getName() + ".properties"; gibberishFileName = pdfFile.getName() + ".txt"; getProperties(propertiesFileName); logger.info("[" + pdfFile.getName() + "] Frequency of villager gibberish is " + frequency + " minutes, give or take " + giveOrTake + " minutes. "); if (afterJoin > 0) { logger.info("[" + pdfFile.getName() + "] Villager gibberish will also occur " + afterJoin + " minutes after a player joins the game. "); } if (nameColor == ChatColor.AQUA) logger.info("[" + pdfFile.getName() + "] Name color is 'lightaqua'. "); else if (nameColor == ChatColor.BLACK) logger.info("[" + pdfFile.getName() + "] Name color is 'black'. "); else if (nameColor == ChatColor.BLUE) logger.info("[" + pdfFile.getName() + "] Name color is 'lightblue'. "); else if (nameColor == ChatColor.DARK_AQUA) logger.info("[" + pdfFile.getName() + "] Name color is 'darkaqua'. "); else if (nameColor == ChatColor.DARK_BLUE) logger.info("[" + pdfFile.getName() + "] Name color is 'darkblue'. "); else if (nameColor == ChatColor.DARK_GRAY) logger.info("[" + pdfFile.getName() + "] Name color is 'darkgray'. "); else if (nameColor == ChatColor.DARK_GREEN) logger.info("[" + pdfFile.getName() + "] Name color is 'darkgreen'. "); else if (nameColor == ChatColor.DARK_PURPLE) logger.info("[" + pdfFile.getName() + "] Name color is 'darkpurple'. "); else if (nameColor == ChatColor.DARK_RED) logger.info("[" + pdfFile.getName() + "] Name color is 'darkred'. "); else if (nameColor == ChatColor.GOLD) logger.info("[" + pdfFile.getName() + "] Name color is 'darkyellow'. "); else if (nameColor == ChatColor.GRAY) logger.info("[" + pdfFile.getName() + "] Name color is 'lightgray'. "); else if (nameColor == ChatColor.GREEN) logger.info("[" + pdfFile.getName() + "] Name color is 'lightgreen'. "); else if (nameColor == ChatColor.LIGHT_PURPLE) logger.info("[" + pdfFile.getName() + "] Name color is 'lightpurple'. "); else if (nameColor == ChatColor.RED) logger.info("[" + pdfFile.getName() + "] Name color is 'lightred'. "); else if (nameColor == ChatColor.WHITE) logger.info("[" + pdfFile.getName() + "] Name color is 'white'. "); else if (nameColor == ChatColor.YELLOW) logger.info("[" + pdfFile.getName() + "] Name color is 'lightyellow'. "); String inputLine = null; countGibberish = 0; gibbering = false; try { BufferedReader reader = new BufferedReader(new FileReader(gibberishFileName)); inputLine = reader.readLine(); while (inputLine != null) { if (inputLine.length() > 0) { addGibberish(inputLine); } inputLine = reader.readLine(); } reader.close(); } catch (FileNotFoundException oops) { logger.info("[" + pdfFile.getName() + "] We could not find file '" + gibberishFileName + "' containing your villagers gibberish. This is not a critical problem, only that your players won't get random gibberish messages during the day."); } catch (IOException oops) { logger.info("[" + pdfFile.getName() + "] We could not find file '" + gibberishFileName + "' containing your villagers gibberish. This is not a critical problem, only that your players won't get random gibberish messages during the day."); } if (countGibberish > 0) { ticking(); } } private void getProperties(String propertiesFileName) { InputStream input = null; try { input = new FileInputStream(propertiesFileName); props.load(input); } catch (FileNotFoundException ok) { saveProperties(propertiesFileName); } catch (IOException oops) { logger.info("[" + pdfFile.getName() + "] Error reading properties file '" + propertiesFileName + "'. "); oops.printStackTrace(System.err); } finally { if (input != null) { try { input.close(); } catch (IOException oops) { oops.printStackTrace(System.err); } } } if (props.getP
    74 downloads
  5. Version 2017-09-16-bFredashay's Villager ChatSep 17, 2017
    Fixed out of bounds exception. If you have only 1 line of gibberish, it doesn't try to choose it at random. It'll only choose one at random if you have more than 1 line of gibberish.
    77 downloads
  6. 2017-09-16Sep 17, 2017
    67 downloads

Similar projects

Plugin →