Java 类org.bukkit.craftbukkit.libs.jline.internal.Log 实例源码

项目:ServerSync    文件:VaultUpdate.java   
@Override
public void run() 
{
    //TODO
    if (Bukkit.getOnlinePlayers().size() > 0)
    {
        for (Player player: Bukkit.getOnlinePlayers()) 
        {
             if (!ServerSync.vault.playerBalances.containsKey(player.getUniqueId().toString()))
             {
                 ServerSync.vault.playerBalances.put(player.getUniqueId().toString(), ServerSync.vault.getVault().getBalance(player));

                 if (ServerSync.verbose)
                 {
                     Log.info(ServerSync.consolePrefix + "Vault - added internal balance for " + player.getName());
                 }
             }
        }
    }

    ServerSync.vault.syncBalances();
}
项目:ServerSync    文件:VaultIO.java   
public void sendVaultBalance(String playerName, double playerBalance)
{
    ByteArrayDataOutput out = ByteStreams.newDataOutput();
    out.writeUTF(ServerSync.vault.vaultSubchannel); //Vault Subchannel
    out.writeUTF(ServerSync.vault.economySubchannel); //Vault Economy Subchannel
    out.writeUTF("Balance"); //Operation
    out.writeUTF(ServerSync.bungeeServerName); //Server Name
    out.writeUTF(ServerSync.pluginVersion); //Client Version
    out.writeUTF(playerName); //Player name

    if (ServerSync.encryption.isEnabled())
    {
        out.writeUTF(ServerSync.encryption.encrypt(String.valueOf(playerBalance)));
    }
    else
    {
        out.writeUTF(Double.toString(playerBalance)+""); //Player balance
    }

    ServerSync.bungeeOutgoing.sendMessage(out, ServerSync.bungeePluginChannel);

    if (ServerSync.verbose)
    {
        Log.info(ServerSync.consolePrefix + "Vault - Balance update sent for " + ChatColor.YELLOW + playerName + " for $" + playerBalance);
    }
}
项目:ServerSync    文件:VaultIO.java   
protected void sendPlayerGroups(OfflinePlayer player, String world, String groups)
{
    ByteArrayDataOutput out = ByteStreams.newDataOutput();
    out.writeUTF(ServerSync.vault.vaultSubchannel);
    out.writeUTF(ServerSync.vault.permissionSubchannel); //Vault Permission sub channel
    out.writeUTF("PlayerGroups"); //Operation
    out.writeUTF(ServerSync.bungeeServerName); //Server Name
    out.writeUTF(ServerSync.pluginVersion); //Client Version
    out.writeUTF(player.getUniqueId().toString()); //Player UUID
    out.writeUTF(world); //World
    out.writeUTF(groups); //Groups

    ServerSync.bungeeOutgoing.sendMessage(out, ServerSync.bungeePluginChannel);

    if (ServerSync.verbose)
    {
        Log.info(ServerSync.consolePrefix + "Vault - Permission group update sent for " + ChatColor.YELLOW + player.getName());
    }
}
项目:ServerSync    文件:pPoints.java   
/**
 * Processes received update for player point balance
 */
protected synchronized void incomingUpdate(String receivedUUID, int balance)
{
    //Update
    UUID uuid = UUID.fromString(receivedUUID);


    getPlayerPoints().getAPI().set(uuid, balance); //Update via API
    playerBalance.put(uuid.toString(), balance); //Update our tracking balance
    lastUpdated.put(uuid.toString(), System.currentTimeMillis() % 1000); //Update last updated

    if (ServerSync.verbose)
    {
        Log.info(ServerSync.consolePrefix + "PlayerPoints - Received update for player ("+uuid+") for ("+balance+") points");
    }
}
项目:ServerSync    文件:pPoints.java   
/**
 * Sends outoing update for player point balance
 */
protected synchronized void outgoingUpdate(String UUID, int balance)
{
    //Check to see if player has tracking data
    if (playerBalance.containsKey(UUID))
    {
        long stamp = System.currentTimeMillis() % 1000; //Tmp timestamp

        playerBalance.put(UUID, balance); //Update tracking balance
        lastUpdated.put(UUID, stamp); //Update out last updated
        playerPointsIO.sendBalanceUpdate(UUID, balance);

        if (ServerSync.verbose)
        {
            Log.info(ServerSync.consolePrefix + "PlayerPoints - sent update for player ("+UUID+") for ("+balance+") points");
        }
    }
}
项目:HelpOp-Email    文件:main.java   
@Override
public void onEnable() {
    createConfig();
    checkTemplate();
    emailEnabled = !config.getBoolean("disable_email", true);
    twilioEnabled = !config.getBoolean("disable_twilio");

    UpdateStatus update = new UpdateChecker("https://github.com/bittiez/HelpOp-Email/raw/master/src/plugin.yml", getDescription().getVersion()).getStatus();
    if (update.HasUpdate) {
        getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
            public void run() {
                Log.info("HelpOp Pro has a new update, check it out at https://github.com/bittiez/HelpOp-Email or https://www.spigotmc.org/resources/helpop-pro.21332/");
            }
        }, 20 * 60);
    }
}
项目:AutismChat3    文件:Config.java   
public static void setupConfig(AutismChat3 plugin) {
    try {
        PrintWriter out = new PrintWriter(plugin.config);
        BufferedReader reader = new BufferedReader(new InputStreamReader(
                AutismChat3.class.getResourceAsStream("/sampleconfig.yml")));

        String currentLine;
        while ((currentLine = reader.readLine()) != null) {
            out.append(currentLine + "\n");
        }
        out.close();
        reader.close();

        config = new YamlConfiguration();
        config.load(plugin.config);
    } catch (Exception e) {
        Log.info(" There was an error setting up the config file...");
        e.printStackTrace();
    }
}
项目:AutismChat3    文件:Messages.java   
public static void setupMessages() {
    try {
        PrintWriter out = new PrintWriter(AutismChat3.messages);
        BufferedReader reader = new BufferedReader(new InputStreamReader(
                AutismChat3.class.getResourceAsStream("/samplemessages.yml")));
        String currentLine;
        while ((currentLine = reader.readLine()) != null) {
            out.append(currentLine + "\n");
        }
        out.close();
        reader.close();

        messagesConfig = new YamlConfiguration();
        messagesConfig.load(AutismChat3.messages);
    } catch (Exception e) {
        Log.info(" There was an error setting up the config file...");
        e.printStackTrace();
    }
}
项目:ZentrelaRPG    文件:MobManager.java   
public static MobData createMob(String identifier, Location loc) {
    MobType mt = MobManager.mobTypes.get(identifier);
    if (mt == null) {
        Log.error("Attempted to spawn non-existing mob " + identifier + ".");
        return null;
    }
    return mt.spawn(loc);
}
项目:ZentrelaCore    文件:PlayerData.java   
public void setRank(String s) {
    try {
        setRank(Rank.valueOf(s.toUpperCase()));
    } catch (Exception e) {
        Log.error("Could not find rank corresponding to '" + s + "'");
        sendMessage(ChatColor.RED + "Could not find rank corresponding to '" + s + "'");
    }
}
项目:ServerSync    文件:BungeeOutgoing.java   
/**
 * Send request over Bungeecord channel to get server name
 */
public void sendServerNameRequest()
{
    ByteArrayDataOutput out = ByteStreams.newDataOutput();
    out.writeUTF("GetServer");

    ServerSync.bungeeOutgoing.sendMessage(out, ServerSync.bungeeChannel);

    if (ServerSync.verbose)
    {
        Log.info(ServerSync.consolePrefix + "Sent server name request");
    }
}
项目:ServerSync    文件:BungeeOutgoing.java   
public void sendServerCheckin()
{
    ByteArrayDataOutput out = ByteStreams.newDataOutput();
    out.writeUTF(ServerSync.bungeeCheckinSubChannel); //Bungee checkin sub-channel
    out.writeUTF("Checkin"); //Operation
    out.writeUTF(ServerSync.bungeeServerName); //Server Name
    out.writeUTF(ServerSync.pluginVersion); //Client Version

    ServerSync.bungeeOutgoing.sendMessage(out, ServerSync.bungeePluginChannel);

    if (ServerSync.verbose)
    {
        Log.info(ServerSync.consolePrefix + "Sent server check-in");
    }
}
项目:ServerSync    文件:Vault.java   
/**
 * Incoming balance update for supplied player
 * @param playerName Username of player
 * @param playerBalane Balance to be updated to
 */
public void incomingEconomySync(String playerName, double playerBalance)
{
    //Add them to our balances list
    OfflinePlayer player = Bukkit.getOfflinePlayer(playerName);
    playerBalances.put(player.getUniqueId().toString(), playerBalance);

    //Compare balances - we only update the value if it's different
    if (ServerSync.vault.getVault().getBalance(player) != playerBalance)
    {
        if (ServerSync.vault.getVault().getBalance(player) > playerBalance)
        {
            //The current balance is more than the received balance
            ServerSync.vault.getVault().withdrawPlayer(player, ServerSync.vault.getVault().getBalance(player) - playerBalance);
        }
        else
        {
            //The current balance is less than the received balance
            ServerSync.vault.getVault().depositPlayer(player, playerBalance - ServerSync.vault.getVault().getBalance(player));
        }

        //If log requested
        if (ServerSync.verbose)
        {
            Log.info(ServerSync.consolePrefix + "Balance received for " + playerName + " - balance updated");
        }
    }
    else
    {
        if (ServerSync.verbose)
        {
            Log.info(ServerSync.consolePrefix + "Balance received for " + playerName + " but balance was the same - update ignored");
        }
    }

}
项目:ServerSync    文件:Vault.java   
/**
 * Sends balance for supplied player and balance
 */
private void outgoingSync(String playerName, double playerBalance)
{
    ServerSync.vault.vaultIO.sendVaultBalance(playerName, playerBalance);

    if (ServerSync.verbose)
    {
        Log.info(ServerSync.consolePrefix + "Balance update sent for " + playerName);
    }
}
项目:ServerSync    文件:ServerSyncEncryption.java   
/**
 * Encrypts passed string
 * @param toEncrypt
 * @return
 */
public String encrypt(String toEncrypt)
{
    String result = "";

    try 
    {
         // Create key and cipher
         Key aesKey = new SecretKeySpec(encryptionKey.getBytes(), "AES");
         Cipher cipher = Cipher.getInstance("AES");

         // encrypt the text
         cipher.init(Cipher.ENCRYPT_MODE, aesKey);
         byte[] encrypted = cipher.doFinal(toEncrypt.getBytes());

         StringBuilder sb = new StringBuilder();
         for (byte b: encrypted) 
         {
             sb.append((char)b);
         }

         result = sb.toString();

    }
    catch(Exception e) 
    {
        Log.error(ServerSync.consolePrefix + "Error while attempting to encrypt string");
    }

    return result;
}
项目:ServerSync    文件:ServerSyncEncryption.java   
/**
 * Decrypts passed string
 * @param toDecrypt
 * @return
 */
public String decrypt(String toDecrypt)
{
    String result = "";

    try 
    {
        // Create key and cipher
        Key aesKey = new SecretKeySpec(encryptionKey.getBytes(), "AES");
        Cipher cipher = Cipher.getInstance("AES");

        byte[] bb = new byte[toDecrypt.length()];
           for (int i=0; i<toDecrypt.length(); i++) {
               bb[i] = (byte) toDecrypt.charAt(i);
           }


        // decrypt the text
        cipher.init(Cipher.DECRYPT_MODE, aesKey);
        result = new String(cipher.doFinal(bb));

    }
    catch(Exception e) 
    {
        Log.error(ServerSync.consolePrefix + "Error while attempting to decrypt string" + encryptionKey);
    }

    return result;
}
项目:ServerSync    文件:pPointsIO.java   
/**
 * Sends balance update for supplied player UUID
 */
protected void sendBalanceUpdate(String UUID, int balance)
{
    ByteArrayDataOutput out = ByteStreams.newDataOutput();
    out.writeUTF(ServerSync.playerPoints.bungeePlayerPointsSubChannel); //Bungee vault sub-channel
    out.writeUTF("Balance"); //Operation
    out.writeUTF(ServerSync.bungeeServerName); //Server Name
    out.writeUTF(ServerSync.pluginVersion); //Client Version
    out.writeUTF(UUID); //Player UUID

    if (ServerSync.encryption.isEnabled())
    {
        out.writeUTF(ServerSync.encryption.encrypt(Integer.toString(balance)));
    }
    else
    {
        //Send unencrypted
        out.writeUTF(Integer.toString(balance)); //Player balance
    }

    ServerSync.bungeeOutgoing.sendMessage(out, ServerSync.bungeePluginChannel); //Send it!

    if (ServerSync.verbose)
    {
        Log.info(ServerSync.chatPrefix + "Player points - Balance update sent for " + ChatColor.YELLOW + UUID);
    }
}
项目:ServerSync    文件:MessageRelay.java   
public void sendCommandRelay(Player player, String command)
{
    ByteArrayDataOutput out = ByteStreams.newDataOutput();
    out.writeUTF(ServerSync.messageRelay.messageSubchannel);
    out.writeUTF("CommandRelay"); //Operation
    out.writeUTF(ServerSync.bungeeServerName); //Server Name
    out.writeUTF(ServerSync.pluginVersion); //Client Version
    out.writeUTF(player.getUniqueId().toString()); //Player UUID

    if (ServerSync.encryption.isEnabled())
    {
        out.writeUTF(ServerSync.encryption.encrypt(command)); //Command
    }
    else
    {
        out.writeUTF(command); //Command
    }

    ServerSync.bungeeOutgoing.sendMessage(out, ServerSync.bungeePluginChannel);

    player.sendMessage(ServerSync.chatPrefix + "Command relay sent " + ChatColor.GREEN + "successfully!");

    if (ServerSync.verbose)
    {
        Log.info(ServerSync.consolePrefix + "MessageRelay - Command relay from " + player.getName() + ChatColor.RED + command);
    }
}
项目:ZentrelaCore    文件:CommandManager.java   
@Override
public void initialize() {
    try {
        Field f = CraftServer.class.getDeclaredField("commandMap");
        f.setAccessible(true);
        cmap = (CommandMap) f.get(plugin.getServer());
    } catch (Exception e) {
        e.printStackTrace();
    }
    if (cmap == null) {
        Log.error("FATAL ERROR: COULD NOT RETRIEVE COMMAND MAP.");
        plugin.getServer().shutdown();
        return;
    }
    AbstractCommand.plugin = plugin;

    // Member
    register(Rank.MEMBER, new TestCommand("testcommand"));
    register(Rank.MEMBER, new PetCommand("pet", "pets"));
    // Mod
    register(SakiCore.TEST_REALM ? Rank.MEMBER : Rank.MOD, new ChangeWorldCommand("changeworld", "cw"));
    register(SakiCore.TEST_REALM ? Rank.MEMBER : Rank.MOD, new TeleportCommand("teleport", "tp"));
    register(Rank.MOD, new TeleportHereCommand("tphere", "teleporthere"));
    register(Rank.MOD, new BanCommand("ban"));
    register(Rank.MOD, new GetIPCommand("getip"));
    register(Rank.MOD, new PardonCommand("pardon"));
    register(Rank.HELPER, new KickCommand("kick")); // manually disable for Builder rank
    register(Rank.HELPER, new MuteCommand("mute")); // manually disable for Builder rank
    register(SakiCore.TEST_REALM ? Rank.MEMBER : Rank.MOD, new BackCommand("back"));
    register(SakiCore.TEST_REALM ? Rank.MEMBER : Rank.MOD, new FlyCommand("fly"));
    register(SakiCore.TEST_REALM ? Rank.MEMBER : Rank.MOD, new FlySpeedCommand("flyspeed"));

    // Admin
    register(Rank.ADMIN, new BanIPCommand("banip", "ipban"));
    // Owner
    register(Rank.OWNER, new SetRankCommand("setrank", "setrankalias"));
    register(Rank.OWNER, new GiveBadgeCommand("givebadge"));
    register(Rank.OWNER, new RemoveBadgeCommand("removebadge"));
    register(Rank.OWNER, new SetInventoryCommand("setinv", "setinventory"));
    register(Rank.OWNER, new ViewInventoryCommand("viewinventory", "checkinventory", "seeinv", "seeinventory"));
    register(Rank.OWNER, new GiveUnlockCommand("giveunlock"));
    register(Rank.OWNER, new RemoveUnlockCommand("removeunlock"));

}
项目:ServerSync    文件:pPointsIO.java   
public void incoming(String channel, Player player, byte[] message) 
{
     //It's on the right channel - let's see if it's on our subchannel
    ByteArrayDataInput in = ByteStreams.newDataInput(message);
    String subchannel = in.readUTF();

    //Vault Communication
    if (subchannel.equalsIgnoreCase(ServerSync.playerPoints.bungeePlayerPointsSubChannel)) 
    {
        //Only read into message if this server has vault enabled
        if (ServerSync.playerPoints.isEnabled())
        {
            String operation = in.readUTF();

            if (operation.equals("BalanceRequest")) //Hub is requesting we send all of the online players balance information
            {
                ServerSync.playerPoints.syncBalances();

                if (ServerSync.verbose)
                {
                    Log.info(ServerSync.consolePrefix + "Player Points - Balance update request received from hub");
                }

            }
            else if (operation.equals("Balance")) //Incoming Balance
            {
                //Receiving balance relay from the hub
                String UUID = in.readUTF(); //UUID
                int balance;

                if (ServerSync.encryption.isEnabled())
                {
                    balance = Integer.parseInt(ServerSync.encryption.decrypt(in.readUTF()));
                }
                else
                {
                    balance = in.readInt();
                }

                if (!UUID.isEmpty() && balance >= 0)
                {
                    //There is some data there, relay
                    ServerSync.playerPoints.incomingUpdate(UUID, balance);

                    if (ServerSync.verbose)
                    {
                        Log.info(ServerSync.consolePrefix + "Player Points - Balance update received for player " + ChatColor.YELLOW + UUID + ChatColor.WHITE + " for $" + ChatColor.GREEN + balance);
                    }
                }
            }
            else if (operation.equals("VersionMismatch")) //Our client version does not match hub version
            {
                String hubVersion = in.readUTF();
                Log.error(ServerSync.consolePrefix + "ServerSync version mismatch! Client version ("+ServerSync.pluginVersion+") does not match hub version ("+hubVersion+")");
            }
        }
    }
}
项目:ServerSync    文件:pPoints.java   
/**
 * Updates ServerSync balances for tracking purposes
 */
protected synchronized void updateInternalBalances()
{
    //PlayerPoints are not effected by time, so we can get away with syncing only online players

    for(Player onlinePlayer : Bukkit.getServer().getOnlinePlayers()) 
    {
        if (playerBalance.containsKey(onlinePlayer.getUniqueId().toString()))
        {
            //Compare balances
            if (playerBalance.get(onlinePlayer.getUniqueId().toString()) != getPlayerPoints().getAPI().look(onlinePlayer.getUniqueId()))
            {
                //Balances differ - update balance and last updated
                playerBalance.put(onlinePlayer.getUniqueId().toString(), getPlayerPoints().getAPI().look(onlinePlayer.getUniqueId()));
                lastUpdated.put(onlinePlayer.getUniqueId().toString(), new Long(System.currentTimeMillis() % 1000));
                updateNeeded.add(onlinePlayer.getUniqueId().toString()); //Add them to update needed

                if (ServerSync.verbose)
                {
                    Log.info(ServerSync.consolePrefix + "PlayerPoints - Updated internal balance for " + onlinePlayer.getName());
                }
            }
        }
        else
        {
            //They're not in our storage

            //Add Balance
            playerBalance.put(onlinePlayer.getUniqueId().toString(), new Integer(getPlayerPoints().getAPI().look(onlinePlayer.getUniqueId())));

            if (ServerSync.verbose)
            {
                Log.info(ServerSync.consolePrefix + "PlayerPoints - Added internal balance for " + onlinePlayer.getName());
            }
        }
    }

    if (ServerSync.verbose)
    {
        //Log.info(ServerSync.consolePrefix + "PlayerPoints - Updated internal balances");
    }
}