Android Open Source - MConsole Server Info






From Project

Back to project page MConsole.

License

The source code is released under:

MIT License

If you think the Android project MConsole listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package pl.skifo.mconsole;
/* w w w.j ava2  s . c o  m*/
import java.io.Serializable;

import android.net.Uri;

public class ServerInfo implements Serializable {

    private static final long serialVersionUID = -7363194944928056891L;
    
    public static final int DEFAULT_PORT = 25575;
    public static final String DEFAULT_ADDRESS = "127.0.0.1";
    
    private String address;
    private String password;
    private int port;
    private String name;
    private boolean cleanPasswdAfterUse = true;
    
    
    public ServerInfo(String address) {
        this.address = address;
        name = address;
        port = DEFAULT_PORT;
        password = "";
    }

    public ServerInfo() {
        this(DEFAULT_ADDRESS);
    }
    
    public void setAddress(String address) {
        this.address = (address == DEFAULT_ADDRESS) ? DEFAULT_ADDRESS:Uri.encode(address);
        if (name == DEFAULT_ADDRESS) {
            name = address;
        }
    }
    
    public void setEncodedName(String eName) {
        name = Uri.decode(eName);
    }

    public void setName(String name) {
        this.name = name;
    }
    
    public String getEncodedName() {
        return Uri.encode(name);
    }

    public String getName() {
        return name;
    }
    
    public void setPort(int p) {
        if (p >= 0 && p < 65536) // validity check
            port = p;
    }
    
    public int getPort() {
        return port;
    }
    
    public String getAddress() {
        return address;
    }

    public void setPassword(String pswd) {
        password = (pswd == null)?"":pswd;
    }
    
    public String getPassword() {
        return password;
    }

    public void cleanAfterUse() {
        if (cleanPasswdAfterUse) {
            password = "";
        }
    }
    
    private String getEncodedPassword() {
        return Uri.encode(password);
    }
    
    public void setEncodedPassword(String ePassword) {
        password = Uri.decode(ePassword);
    }
    
    @Override
    public String toString() {
        return name;
    }
    
    public String toExternalForm() {
        return getAddress()+","+getEncodedName()+","+port+","+getEncodedPassword(); 
    }

    
}




Java Source Code List

pl.skifo.mconsole.AttributedBlock.java
pl.skifo.mconsole.AttributedLine.java
pl.skifo.mconsole.AttributedString.java
pl.skifo.mconsole.BanlistDialog.java
pl.skifo.mconsole.CommandPrompt.java
pl.skifo.mconsole.CommandResponseEvaluator.java
pl.skifo.mconsole.CommandSet.java
pl.skifo.mconsole.ConfirmDialog.java
pl.skifo.mconsole.ConsoleOutputImpl.java
pl.skifo.mconsole.ConsoleOutput.java
pl.skifo.mconsole.MConsoleActivity.java
pl.skifo.mconsole.MinecraftColorScheme.java
pl.skifo.mconsole.PlayerActionTp.java
pl.skifo.mconsole.PlayerAdminBan.java
pl.skifo.mconsole.PlayerAdminMode.java
pl.skifo.mconsole.PlayerListAdapter.java
pl.skifo.mconsole.PlayersFragment.java
pl.skifo.mconsole.ResponseEvaluator.java
pl.skifo.mconsole.ResponseReceiver.java
pl.skifo.mconsole.ResponseToastGenerator.java
pl.skifo.mconsole.SayDialog.java
pl.skifo.mconsole.ServerConnector.java
pl.skifo.mconsole.ServerConsoleFragment.java
pl.skifo.mconsole.ServerConsole.java
pl.skifo.mconsole.ServerFragment.java
pl.skifo.mconsole.ServerInfo.java
pl.skifo.mconsole.ServerResponse.java
pl.skifo.mconsole.SimpleToastResponseReceiver.java
pl.skifo.mconsole.TabsPagerAdapter.java
pl.skifo.mconsole.TellDialog.java
pl.skifo.mconsole.TimeSetDialog.java
pl.skifo.mconsole.UserActionDialog.java
pl.skifo.mconsole.UserAdminDialog.java