Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package eu.globemc.development.bar;
- import java.io.IOException;
- import java.nio.ByteBuffer;
- import java.nio.charset.Charset;
- import java.nio.charset.StandardCharsets;
- import java.nio.file.Files;
- import java.nio.file.Paths;
- import me.confuser.barapi.BarAPI;
- import org.bukkit.Bukkit;
- import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer;
- import org.bukkit.entity.Player;
- public class Bar {
- static Scroller scroller;
- public static void scroll(){
- if(Bukkit.getServer().getPort()>10015&&Bukkit.getServer().getPort()<11000){
- }else{
- String message = scroller.next();
- for(Player p:Bukkit.getOnlinePlayers()){
- if (((CraftPlayer) p).getHandle().playerConnection.networkManager.getVersion() >= 47) {
- }else{
- BarAPI.setMessage(p, message);
- }
- }
- }
- }
- public static String updateBar(){
- String text="Error";
- try {
- text = readFile("/home/Network/message.txt", StandardCharsets.UTF_8);
- scroller = new Scroller(text, 70, 1, '&');
- return text;
- } catch (IOException e) {
- return null;
- }
- }
- static String readFile(String path, Charset encoding) throws IOException{
- byte[] encoded = Files.readAllBytes(Paths.get(path));
- return encoding.decode(ByteBuffer.wrap(encoded)).toString();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement