Merge branch 'master' of ssh://198.245.50.91:7999/min/master
This commit is contained in:
commit
96f6862bd1
@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre7"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Nautilus.Core.Server"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Nautilus.Core"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/bukkit.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
|
||||
<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Nautilus.Core.VoteHub"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/Nautilus.Core.VoteHub/Hub.xml}"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value=""/>
|
||||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/Nautilus.Core.VoteHub}"/>
|
||||
</launchConfiguration>
|
@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Nautilus.Core.VoteHub</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
<dictionary>
|
||||
<key>LaunchConfigHandle</key>
|
||||
<value><project>/.externalToolBuilders/VoteHub.launch</value>
|
||||
</dictionary>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -1,11 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="VoteHub" default="VoteHub" basedir=".">
|
||||
<target name ="VoteHub" description="VoteHub">
|
||||
<jar jarfile="../bin/VoteHub.jar">
|
||||
<fileset dir="../Nautilus.Core.VoteHub/bin">
|
||||
<include name="**/*.class"/>
|
||||
</fileset>
|
||||
<fileset dir="../Nautilus.Core.Server/bin">
|
||||
<include name="**/*.class"/>
|
||||
</fileset>
|
||||
<fileset dir="../Plugins/Nautilus.Core/bin">
|
||||
<include name="**/*.class"/>
|
||||
</fileset>
|
||||
|
||||
<zipfileset src="../Plugins/Libraries/bukkit.jar" />
|
||||
<zipfileset src="../Plugins/Libraries/commons-io-2.4.jar" />
|
||||
<zipfileset src="../Plugins/Libraries/gson-2.2.1.jar" />
|
||||
<zipfileset src="../Plugins/Libraries/httpcore-4.2.jar" />
|
||||
<zipfileset src="../Plugins/Libraries/httpclient-4.2.jar" />
|
||||
<zipfileset src="../Plugins/Libraries/commons-logging-1.1.1.jar" />
|
||||
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="nautilus.core.votehub.Program" />
|
||||
</manifest>
|
||||
</jar>
|
||||
<copy file="../bin/VoteHub.jar" todir="../Testing/VoteHub"/>
|
||||
</target>
|
||||
</project>
|
@ -1,40 +0,0 @@
|
||||
package nautilus.core.votehub;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
VoteHub hub = new VoteHub();
|
||||
System.out.println("Enabled Nautilus Vote Hub");
|
||||
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader( System.in ));
|
||||
|
||||
while (hub.IsRunning())
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.sleep(25);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
String line = br.readLine();
|
||||
if (line != null)
|
||||
{
|
||||
boolean handled = hub.ProcessCommand(line);
|
||||
|
||||
if (!handled)
|
||||
{
|
||||
System.err.println("Command not found");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
package nautilus.core.votehub;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import mineplex.core.server.ServerBroadcaster;
|
||||
import nautilus.core.votehub.votifier.net.VoteReceiver;
|
||||
|
||||
public class VoteHub
|
||||
{
|
||||
private String WEB_CONFIG = "webServer";
|
||||
private String IP = "ip";
|
||||
private String PORT = "port";
|
||||
private String CONFIG_FILE = "config.yml";
|
||||
|
||||
private FileConfiguration _config;
|
||||
private VoteReceiver _voteReceiver;
|
||||
private boolean _isRunning = true;
|
||||
|
||||
private ServerBroadcaster _serverTalker;
|
||||
|
||||
public VoteHub()
|
||||
{
|
||||
_config = YamlConfiguration.loadConfiguration(new File(CONFIG_FILE));
|
||||
|
||||
_config.addDefault(WEB_CONFIG, "http://bettermc.com/");
|
||||
_config.set(WEB_CONFIG, _config.getString(WEB_CONFIG));
|
||||
|
||||
_config.addDefault(IP, "bettermc.com");
|
||||
_config.set(IP, _config.getString(IP));
|
||||
|
||||
_config.addDefault(PORT, 8192);
|
||||
_config.set(PORT, _config.getInt(PORT));
|
||||
|
||||
try
|
||||
{
|
||||
_config.save(CONFIG_FILE);
|
||||
}
|
||||
catch (IOException e1)
|
||||
{
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
_config = YamlConfiguration.loadConfiguration(new File(CONFIG_FILE));
|
||||
_serverTalker = new ServerBroadcaster(_config.getString(WEB_CONFIG));
|
||||
_serverTalker.start();
|
||||
|
||||
try
|
||||
{
|
||||
_voteReceiver = new VoteReceiver(_serverTalker, _config.getString(WEB_CONFIG), _config.getString(IP), _config.getInt(PORT));
|
||||
_voteReceiver.start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean IsRunning()
|
||||
{
|
||||
return _isRunning;
|
||||
}
|
||||
|
||||
public boolean ProcessCommand(String line)
|
||||
{
|
||||
if (line.equalsIgnoreCase("stop"))
|
||||
{
|
||||
_isRunning = false;
|
||||
System.out.println("Shutting down...");
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (line.equalsIgnoreCase("packets"))
|
||||
{
|
||||
_serverTalker.PrintPackets();
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (line.equalsIgnoreCase("servers"))
|
||||
{
|
||||
_serverTalker.PrintServers();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
package nautilus.core.votehub.votifier;
|
||||
|
||||
import java.util.logging.*;
|
||||
|
||||
/**
|
||||
* A custom log filter for prepending plugin identifier on all log messages.
|
||||
*
|
||||
* @author frelling
|
||||
*
|
||||
*/
|
||||
class LogFilter implements Filter {
|
||||
|
||||
private String prefix;
|
||||
|
||||
/**
|
||||
* Constructs a log filter that prepends the given prefix on all log
|
||||
* messages.
|
||||
*
|
||||
* @param prefix
|
||||
*/
|
||||
public LogFilter(String prefix) {
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Always returns true, but adds prefix to log message.
|
||||
*/
|
||||
public boolean isLoggable(LogRecord record) {
|
||||
record.setMessage(prefix + record.getMessage());
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Vex Software LLC
|
||||
* This file is part of Votifier.
|
||||
*
|
||||
* Votifier is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Votifier is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Votifier. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package nautilus.core.votehub.votifier.crypto;
|
||||
|
||||
import java.security.PrivateKey;
|
||||
import java.security.PublicKey;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
|
||||
/**
|
||||
* Static RSA utility methods for encrypting and decrypting blocks of
|
||||
* information.
|
||||
*
|
||||
* @author Blake Beaupain
|
||||
*/
|
||||
public class RSA {
|
||||
|
||||
/**
|
||||
* Encrypts a block of data.
|
||||
*
|
||||
* @param data
|
||||
* The data to encrypt
|
||||
* @param key
|
||||
* The key to encrypt with
|
||||
* @return The encrypted data
|
||||
* @throws Exception
|
||||
* If an error occurs
|
||||
*/
|
||||
public static byte[] encrypt(byte[] data, PublicKey key) throws Exception {
|
||||
Cipher cipher = Cipher.getInstance("RSA");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, key);
|
||||
return cipher.doFinal(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrypts a block of data.
|
||||
*
|
||||
* @param data
|
||||
* The data to decrypt
|
||||
* @param key
|
||||
* The key to decrypt with
|
||||
* @return The decrypted data
|
||||
* @throws Exception
|
||||
* If an error occurs
|
||||
*/
|
||||
public static byte[] decrypt(byte[] data, PrivateKey key) throws Exception {
|
||||
Cipher cipher = Cipher.getInstance("RSA");
|
||||
cipher.init(Cipher.DECRYPT_MODE, key);
|
||||
return cipher.doFinal(data);
|
||||
}
|
||||
|
||||
}
|
@ -1,111 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Vex Software LLC
|
||||
* This file is part of Votifier.
|
||||
*
|
||||
* Votifier is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Votifier is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Votifier. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package nautilus.core.votehub.votifier.crypto;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.KeyPair;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.PublicKey;
|
||||
import java.security.spec.PKCS8EncodedKeySpec;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
|
||||
/**
|
||||
* Static utility methods for saving and loading RSA key pairs.
|
||||
*
|
||||
* @author Blake Beaupain
|
||||
*/
|
||||
public class RSAIO {
|
||||
|
||||
/**
|
||||
* Saves the key pair to the disk.
|
||||
*
|
||||
* @param directory
|
||||
* The directory to save to
|
||||
* @param keyPair
|
||||
* The key pair to save
|
||||
* @throws Exception
|
||||
* If an error occurs
|
||||
*/
|
||||
public static void save(File directory, KeyPair keyPair) throws Exception {
|
||||
PrivateKey privateKey = keyPair.getPrivate();
|
||||
PublicKey publicKey = keyPair.getPublic();
|
||||
|
||||
// Store the public key.
|
||||
X509EncodedKeySpec publicSpec = new X509EncodedKeySpec(
|
||||
publicKey.getEncoded());
|
||||
FileOutputStream out = new FileOutputStream(directory + "/public.key");
|
||||
out.write(DatatypeConverter.printBase64Binary(publicSpec.getEncoded())
|
||||
.getBytes());
|
||||
out.close();
|
||||
|
||||
// Store the private key.
|
||||
PKCS8EncodedKeySpec privateSpec = new PKCS8EncodedKeySpec(
|
||||
privateKey.getEncoded());
|
||||
out = new FileOutputStream(directory + "/private.key");
|
||||
out.write(DatatypeConverter.printBase64Binary(privateSpec.getEncoded())
|
||||
.getBytes());
|
||||
out.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads an RSA key pair from a directory. The directory must have the files
|
||||
* "public.key" and "private.key".
|
||||
*
|
||||
* @param directory
|
||||
* The directory to load from
|
||||
* @return The key pair
|
||||
* @throws Exception
|
||||
* If an error occurs
|
||||
*/
|
||||
public static KeyPair load(File directory) throws Exception {
|
||||
// Read the public key file.
|
||||
File publicKeyFile = new File(directory + "/public.key");
|
||||
FileInputStream in = new FileInputStream(directory + "/public.key");
|
||||
byte[] encodedPublicKey = new byte[(int) publicKeyFile.length()];
|
||||
in.read(encodedPublicKey);
|
||||
encodedPublicKey = DatatypeConverter.parseBase64Binary(new String(
|
||||
encodedPublicKey));
|
||||
in.close();
|
||||
|
||||
// Read the private key file.
|
||||
File privateKeyFile = new File(directory + "/private.key");
|
||||
in = new FileInputStream(directory + "/private.key");
|
||||
byte[] encodedPrivateKey = new byte[(int) privateKeyFile.length()];
|
||||
in.read(encodedPrivateKey);
|
||||
encodedPrivateKey = DatatypeConverter.parseBase64Binary(new String(
|
||||
encodedPrivateKey));
|
||||
in.close();
|
||||
|
||||
// Instantiate and return the key pair.
|
||||
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(
|
||||
encodedPublicKey);
|
||||
PublicKey publicKey = keyFactory.generatePublic(publicKeySpec);
|
||||
PKCS8EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec(
|
||||
encodedPrivateKey);
|
||||
PrivateKey privateKey = keyFactory.generatePrivate(privateKeySpec);
|
||||
return new KeyPair(publicKey, privateKey);
|
||||
}
|
||||
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Vex Software LLC
|
||||
* This file is part of Votifier.
|
||||
*
|
||||
* Votifier is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Votifier is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Votifier. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package nautilus.core.votehub.votifier.crypto;
|
||||
|
||||
import java.security.KeyPair;
|
||||
import java.security.KeyPairGenerator;
|
||||
import java.security.spec.RSAKeyGenParameterSpec;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* An RSA key pair generator.
|
||||
*
|
||||
* @author Blake Beaupain
|
||||
*/
|
||||
public class RSAKeygen {
|
||||
|
||||
/** The logger instance. */
|
||||
private static final Logger LOG = Logger.getLogger("Votifier");
|
||||
|
||||
/**
|
||||
* Generates an RSA key pair.
|
||||
*
|
||||
* @param bits
|
||||
* The amount of bits
|
||||
* @return The key pair
|
||||
*/
|
||||
public static KeyPair generate(int bits) throws Exception {
|
||||
LOG.info("Votifier is generating an RSA key pair...");
|
||||
KeyPairGenerator keygen = KeyPairGenerator.getInstance("RSA");
|
||||
RSAKeyGenParameterSpec spec = new RSAKeyGenParameterSpec(bits,
|
||||
RSAKeyGenParameterSpec.F4);
|
||||
keygen.initialize(spec);
|
||||
return keygen.generateKeyPair();
|
||||
}
|
||||
|
||||
}
|
@ -1,122 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Vex Software LLC
|
||||
* This file is part of Votifier.
|
||||
*
|
||||
* Votifier is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Votifier is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Votifier. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package nautilus.core.votehub.votifier.model;
|
||||
|
||||
/**
|
||||
* A model for a vote.
|
||||
*
|
||||
* @author Blake Beaupain
|
||||
*/
|
||||
public class Vote {
|
||||
|
||||
/** The name of the vote service. */
|
||||
private String serviceName;
|
||||
|
||||
/** The username of the voter. */
|
||||
private String username;
|
||||
|
||||
/** The address of the voter. */
|
||||
private String address;
|
||||
|
||||
/** The date and time of the vote. */
|
||||
private String timeStamp;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Vote (from:" + serviceName + " username:" + username
|
||||
+ " address:" + address + " timeStamp:" + timeStamp + ")";
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the serviceName.
|
||||
*
|
||||
* @param serviceName
|
||||
* The new serviceName
|
||||
*/
|
||||
public void setServiceName(String serviceName) {
|
||||
this.serviceName = serviceName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the serviceName.
|
||||
*
|
||||
* @return The serviceName
|
||||
*/
|
||||
public String getServiceName() {
|
||||
return serviceName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the username.
|
||||
*
|
||||
* @param username
|
||||
* The new username
|
||||
*/
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the username.
|
||||
*
|
||||
* @return The username
|
||||
*/
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the address.
|
||||
*
|
||||
* @param address
|
||||
* The new address
|
||||
*/
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the address.
|
||||
*
|
||||
* @return The address
|
||||
*/
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the time stamp.
|
||||
*
|
||||
* @param timeStamp
|
||||
* The new time stamp
|
||||
*/
|
||||
public void setTimeStamp(String timeStamp) {
|
||||
this.timeStamp = timeStamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the time stamp.
|
||||
*
|
||||
* @return The time stamp
|
||||
*/
|
||||
public String getTimeStamp() {
|
||||
return timeStamp;
|
||||
}
|
||||
|
||||
}
|
@ -1,213 +0,0 @@
|
||||
package nautilus.core.votehub.votifier.net;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
import java.security.KeyPair;
|
||||
import java.util.logging.*;
|
||||
import javax.crypto.BadPaddingException;
|
||||
|
||||
import mineplex.core.server.ServerBroadcaster;
|
||||
import mineplex.core.server.packet.PlayerVotePacket;
|
||||
import mineplex.core.server.remotecall.AsyncJsonWebCall;
|
||||
import mineplex.core.server.util.Callback;
|
||||
import mineplex.minecraft.donation.repository.token.PlayerUpdateToken;
|
||||
import nautilus.core.votehub.votifier.crypto.RSA;
|
||||
import nautilus.core.votehub.votifier.crypto.RSAIO;
|
||||
import nautilus.core.votehub.votifier.crypto.RSAKeygen;
|
||||
import nautilus.core.votehub.votifier.model.Vote;
|
||||
|
||||
public class VoteReceiver extends Thread
|
||||
{
|
||||
private static final Logger LOG = Logger.getLogger("Votifier");
|
||||
|
||||
private final String _host;
|
||||
private final int _port;
|
||||
|
||||
private KeyPair _keyPair;
|
||||
|
||||
private ServerSocket server;
|
||||
private ServerBroadcaster _serverTalker;
|
||||
|
||||
private String _webserver;
|
||||
|
||||
private boolean running = true;
|
||||
|
||||
public VoteReceiver(ServerBroadcaster serverTalker, String webserver, String host, int port) throws Exception
|
||||
{
|
||||
_serverTalker = serverTalker;
|
||||
_webserver = webserver;
|
||||
_host = host;
|
||||
_port = port;
|
||||
|
||||
initialize();
|
||||
}
|
||||
|
||||
private void initialize() throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
server = new ServerSocket();
|
||||
server.bind(new InetSocketAddress(_host, _port));
|
||||
System.out.println("Bound to : " + _host + ":" + _port);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LOG.log(Level.SEVERE, "Error initializing vote receiver. Please verify that the configured");
|
||||
LOG.log(Level.SEVERE, "IP address and port are not already in use. This is a common problem");
|
||||
LOG.log(Level.SEVERE, "with hosting services and, if so, you should check with your hosting provider.", ex);
|
||||
throw new Exception(ex);
|
||||
}
|
||||
|
||||
File rsaDirectory = new File("rsa/");
|
||||
|
||||
try
|
||||
{
|
||||
if (!rsaDirectory.exists())
|
||||
{
|
||||
rsaDirectory.mkdir();
|
||||
_keyPair = RSAKeygen.generate(2048);
|
||||
RSAIO.save(rsaDirectory, _keyPair);
|
||||
}
|
||||
else
|
||||
{
|
||||
_keyPair = RSAIO.load(rsaDirectory);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LOG.log(Level.SEVERE, "Error reading configuration file or RSA keys", ex);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void shutdown()
|
||||
{
|
||||
running = false;
|
||||
if (server == null)
|
||||
return;
|
||||
try
|
||||
{
|
||||
server.close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LOG.log(Level.WARNING, "Unable to shut down vote receiver cleanly.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
while (running)
|
||||
{
|
||||
try
|
||||
{
|
||||
Socket socket = server.accept();
|
||||
socket.setSoTimeout(5000); // Don't hang on slow connections.
|
||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
|
||||
InputStream in = socket.getInputStream();
|
||||
|
||||
// Send them our version.
|
||||
writer.write("VOTIFIER 1.9");
|
||||
writer.newLine();
|
||||
writer.flush();
|
||||
|
||||
// Read the 256 byte block.
|
||||
byte[] block = new byte[256];
|
||||
in.read(block, 0, block.length);
|
||||
|
||||
// Decrypt the block.
|
||||
block = RSA.decrypt(block, _keyPair.getPrivate());
|
||||
int position = 0;
|
||||
|
||||
// Perform the opcode check.
|
||||
String opcode = readString(block, position);
|
||||
position += opcode.length() + 1;
|
||||
|
||||
if (!opcode.equals("VOTE"))
|
||||
{
|
||||
throw new Exception("Unable to decode RSA");
|
||||
}
|
||||
|
||||
// Parse the block.
|
||||
String serviceName = readString(block, position);
|
||||
position += serviceName.length() + 1;
|
||||
String username = readString(block, position);
|
||||
position += username.length() + 1;
|
||||
String address = readString(block, position);
|
||||
position += address.length() + 1;
|
||||
String timeStamp = readString(block, position);
|
||||
position += timeStamp.length() + 1;
|
||||
|
||||
// Create the vote.
|
||||
final Vote vote = new Vote();
|
||||
vote.setServiceName(serviceName);
|
||||
vote.setUsername(username);
|
||||
vote.setAddress(address);
|
||||
vote.setTimeStamp(timeStamp);
|
||||
|
||||
System.out.println(serviceName);
|
||||
System.out.println(address);
|
||||
|
||||
if (serviceName.equalsIgnoreCase("MinecraftServers.org") || serviceName.equalsIgnoreCase("Minestatus"))
|
||||
{
|
||||
new AsyncJsonWebCall(_webserver + "PlayerAccount/PlayerVoted").Execute(PlayerUpdateToken.class, new Callback<PlayerUpdateToken>()
|
||||
{
|
||||
public void run(PlayerUpdateToken token)
|
||||
{
|
||||
_serverTalker.QueuePacket(new PlayerVotePacket(vote.getUsername(), token.Points));
|
||||
}
|
||||
}, username);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("Received invalid vote from : " + serviceName + " for username : " + username + " at : " + timeStamp);
|
||||
}
|
||||
|
||||
// Clean up.
|
||||
writer.close();
|
||||
in.close();
|
||||
socket.close();
|
||||
}
|
||||
catch (SocketException ex)
|
||||
{
|
||||
LOG.log(Level.WARNING, "Protocol error. Ignoring packet - " + ex.getLocalizedMessage());
|
||||
}
|
||||
catch (BadPaddingException ex)
|
||||
{
|
||||
LOG.log(Level.WARNING, "Unable to decrypt vote record. Make sure that that your public key");
|
||||
LOG.log(Level.WARNING, "matches the one you gave the server list.", ex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LOG.log(Level.WARNING, "Exception caught while receiving a vote notification", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a string from a block of data.
|
||||
*
|
||||
* @param data
|
||||
* The data to read from
|
||||
* @return The string
|
||||
*/
|
||||
private String readString(byte[] data, int offset)
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (int i = offset; i < data.length; i++)
|
||||
{
|
||||
if (data[i] == '\n')
|
||||
break; // Delimiter reached.
|
||||
|
||||
builder.append((char) data[i]);
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
@ -35,7 +35,8 @@
|
||||
<zipfileset src="../Libraries/httpclient-cache-4.2.jar" />
|
||||
<zipfileset src="../Libraries/httpmime-4.2.jar" />
|
||||
<zipfileset src="../Libraries/gson-2.2.1.jar" />
|
||||
<zipfileset src="../Libraries/commons-logging-1.1.1.jar" />
|
||||
<zipfileset src="../Libraries/commons-logging-1.1.1.jar" />
|
||||
<zipfileset src="../Libraries/commons-codec-1.6.jar" />
|
||||
</jar>
|
||||
<copy file="../bin/Dominate.jar" todir="../../Testing/Dominate/plugins"/>
|
||||
</target>
|
||||
@ -63,6 +64,7 @@
|
||||
<zipfileset src="../Libraries/httpmime-4.2.jar" />
|
||||
<zipfileset src="../Libraries/gson-2.2.1.jar" />
|
||||
<zipfileset src="../Libraries/commons-logging-1.1.1.jar" />
|
||||
<zipfileset src="../Libraries/commons-codec-1.6.jar" />
|
||||
</jar>
|
||||
<copy file="../bin/CaptureThePig.jar" todir="../../Testing/CaptureThePig/plugins"/>
|
||||
</target>
|
||||
@ -87,6 +89,7 @@
|
||||
<zipfileset src="../Libraries/httpmime-4.2.jar" />
|
||||
<zipfileset src="../Libraries/gson-2.2.1.jar" />
|
||||
<zipfileset src="../Libraries/commons-logging-1.1.1.jar" />
|
||||
<zipfileset src="../Libraries/commons-codec-1.6.jar" />
|
||||
</jar>
|
||||
<copy file="../bin/PvP.jar" todir="../../Testing/PvP/plugins"/>
|
||||
</target>
|
||||
@ -111,6 +114,7 @@
|
||||
<zipfileset src="../Libraries/httpmime-4.2.jar" />
|
||||
<zipfileset src="../Libraries/gson-2.2.1.jar" />
|
||||
<zipfileset src="../Libraries/commons-logging-1.1.1.jar" />
|
||||
<zipfileset src="../Libraries/commons-codec-1.6.jar" />
|
||||
</jar>
|
||||
<copy file="../bin/Tutorial.jar" todir="../../Testing/Tutorial/plugins"/>
|
||||
</target>
|
||||
@ -146,6 +150,7 @@
|
||||
<zipfileset src="../Libraries/httpmime-4.2.jar" />
|
||||
<zipfileset src="../Libraries/gson-2.2.1.jar" />
|
||||
<zipfileset src="../Libraries/commons-logging-1.1.1.jar" />
|
||||
<zipfileset src="../Libraries/commons-codec-1.6.jar" />
|
||||
</jar>
|
||||
<copy file="../bin/Arcade.jar" todir="../../Testing/Arcade/plugins"/>
|
||||
</target>
|
||||
@ -183,7 +188,8 @@
|
||||
<zipfileset src="../Libraries/httpclient-cache-4.2.jar" />
|
||||
<zipfileset src="../Libraries/httpmime-4.2.jar" />
|
||||
<zipfileset src="../Libraries/gson-2.2.1.jar" />
|
||||
<zipfileset src="../Libraries/commons-logging-1.1.1.jar" />
|
||||
<zipfileset src="../Libraries/commons-logging-1.1.1.jar" />
|
||||
<zipfileset src="../Libraries/commons-codec-1.6.jar" />
|
||||
</jar>
|
||||
<copy file="../bin/Hub.jar" todir="../../Testing/Hub/plugins"/>
|
||||
</target>
|
||||
@ -218,36 +224,10 @@
|
||||
<zipfileset src="../Libraries/httpmime-4.2.jar" />
|
||||
<zipfileset src="../Libraries/gson-2.2.1.jar" />
|
||||
<zipfileset src="../Libraries/commons-logging-1.1.1.jar" />
|
||||
<zipfileset src="../Libraries/commons-codec-1.6.jar" />
|
||||
</jar>
|
||||
<copy file="../bin/MineKart.jar" todir="../../Testing/MineKart/plugins"/>
|
||||
</target>
|
||||
<target name ="Lobby" description="Lobby">
|
||||
<jar jarfile="../bin/Lobby.jar">
|
||||
<fileset dir="../Nautilus.Game.Lobby/bin">
|
||||
<include name="**/*.class"/>
|
||||
</fileset>
|
||||
<fileset dir="../Core/bin">
|
||||
<include name="**/*.class"/>
|
||||
</fileset>
|
||||
<fileset dir="../Nautilus.Core/bin">
|
||||
<include name="**/*.class"/>
|
||||
</fileset>
|
||||
<fileset dir="../../Nautilus.Core.Server/bin">
|
||||
<include name="**/*.class"/>
|
||||
</fileset>
|
||||
<fileset dir="../Nautilus.Game.Lobby">
|
||||
<include name="*.yml"/>
|
||||
</fileset>
|
||||
|
||||
<zipfileset src="../Libraries/httpclient-4.2.jar" />
|
||||
<zipfileset src="../Libraries/httpcore-4.2.jar" />
|
||||
<zipfileset src="../Libraries/httpclient-cache-4.2.jar" />
|
||||
<zipfileset src="../Libraries/httpmime-4.2.jar" />
|
||||
<zipfileset src="../Libraries/gson-2.2.1.jar" />
|
||||
<zipfileset src="../Libraries/commons-logging-1.1.1.jar" />
|
||||
</jar>
|
||||
<copy file="../bin/Lobby.jar" todir="../../Testing/Lobby/plugins"/>
|
||||
</target>
|
||||
<target name="NautilusCraftBukkit2" description="NautilusCraftBukkit2">
|
||||
<copy file="../Libraries/craftbukkit.jar" todir="../bin/" overwrite="true"/>
|
||||
<jar jarfile="../bin/craftbukkit.jar" update="true">
|
||||
|
@ -6,7 +6,6 @@ import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.server.v1_6_R2.EntityCreature;
|
||||
import net.minecraft.server.v1_6_R2.EntityHuman;
|
||||
import net.minecraft.server.v1_6_R2.EntityMonster;
|
||||
import net.minecraft.server.v1_6_R2.EntityInsentient;
|
||||
import net.minecraft.server.v1_6_R2.PathfinderGoalLookAtPlayer;
|
||||
import net.minecraft.server.v1_6_R2.PathfinderGoalMoveTowardsRestriction;
|
||||
|
@ -2,11 +2,11 @@
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre7"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/bukkit.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Nautilus.Core.CraftBukkit"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar" sourcepath="/REPO_DIR/GitHubLibraries/CraftBukkit/src"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpcore-4.2.jar"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpclient-4.2.jar"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/bin/craftbukkit.jar"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/commons-codec-1.6.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
@ -15,7 +15,7 @@ public class PetShop extends ShopBase<PetManager> implements PluginMessageListen
|
||||
{
|
||||
public PetShop(PetManager plugin, CoreClientManager manager, DonationManager donationManager)
|
||||
{
|
||||
super(plugin, manager, donationManager, "Pet Keeper", CurrencyType.Gems);
|
||||
super(plugin, manager, donationManager, "Pet Shop", CurrencyType.Gems);
|
||||
|
||||
plugin.GetPlugin().getServer().getMessenger().registerIncomingPluginChannel(plugin.GetPlugin(), "MC|ItemName", this);
|
||||
}
|
||||
|
@ -92,6 +92,14 @@ public class Portal extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
public void SendAllPlayers(String serverName)
|
||||
{
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
SendPlayerToServer(player, serverName);
|
||||
}
|
||||
}
|
||||
|
||||
public void SendPlayerToServer(final Player player, String serverName)
|
||||
{
|
||||
if (_connectingPlayers.contains(player.getName()))
|
||||
|
@ -9,6 +9,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
@ -57,27 +58,46 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
|
||||
return _availableCurrencyTypes;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void OnPlayerDamageEntity(EntityDamageByEntityEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof LivingEntity)
|
||||
{
|
||||
if (event.getDamager() instanceof Player)
|
||||
{
|
||||
if (AttemptShopOpen((Player)event.getDamager(), (LivingEntity)event.getEntity()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void OnPlayerInteractEntity(PlayerInteractEntityEvent event)
|
||||
{
|
||||
if (event.getRightClicked() instanceof LivingEntity)
|
||||
{
|
||||
LivingEntity rightClicked = (LivingEntity)event.getRightClicked();
|
||||
|
||||
if (rightClicked.isCustomNameVisible() && rightClicked.getCustomName() != null && ChatColor.stripColor(rightClicked.getCustomName()).equalsIgnoreCase(ChatColor.stripColor(Name)))
|
||||
{
|
||||
OpenShopForPlayer(event.getPlayer());
|
||||
if (!PlayerPageMap.containsKey(event.getPlayer().getName()))
|
||||
{
|
||||
PlayerPageMap.put(event.getPlayer().getName(), BuildPagesFor(event.getPlayer()));
|
||||
}
|
||||
|
||||
OpenPageForPlayer(event.getPlayer(), GetOpeningPageForPlayer(event.getPlayer()));
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
if (AttemptShopOpen(event.getPlayer(), (LivingEntity)event.getRightClicked()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean AttemptShopOpen(Player player, LivingEntity entity)
|
||||
{
|
||||
if (entity.isCustomNameVisible() && entity.getCustomName() != null && ChatColor.stripColor(entity.getCustomName()).equalsIgnoreCase(ChatColor.stripColor(Name)))
|
||||
{
|
||||
OpenShopForPlayer(player);
|
||||
if (!PlayerPageMap.containsKey(player.getName()))
|
||||
{
|
||||
PlayerPageMap.put(player.getName(), BuildPagesFor(player));
|
||||
}
|
||||
|
||||
OpenPageForPlayer(player, GetOpeningPageForPlayer(player));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected ShopPageBase<PluginType, ? extends ShopBase<PluginType>> GetOpeningPageForPlayer(Player player)
|
||||
{
|
||||
|
144
Plugins/Mineplex.Core/src/mineplex/core/updater/FileUpdater.java
Normal file
144
Plugins/Mineplex.Core/src/mineplex/core/updater/FileUpdater.java
Normal file
@ -0,0 +1,144 @@
|
||||
package mineplex.core.updater;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class FileUpdater extends MiniPlugin
|
||||
{
|
||||
private NautHashMap<String, String> _jarMd5Map = new NautHashMap<String, String>();
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private boolean _needUpdate;
|
||||
|
||||
public FileUpdater(JavaPlugin plugin)
|
||||
{
|
||||
super("File Updater", plugin);
|
||||
|
||||
GetPluginMd5s();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void CheckForNewFiles(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.MIN_01)
|
||||
return;
|
||||
|
||||
boolean windows = System.getProperty("os.name").startsWith("Windows");
|
||||
|
||||
File updateDir = new File((windows ? "C:" : File.separator + "home" + File.separator + "mineplex") + File.separator + "update");
|
||||
|
||||
updateDir.mkdirs();
|
||||
|
||||
FilenameFilter statsFilter = new FilenameFilter()
|
||||
{
|
||||
public boolean accept(File paramFile, String paramString)
|
||||
{
|
||||
if (paramString.endsWith("jar"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
for (File f : updateDir.listFiles(statsFilter))
|
||||
{
|
||||
FileInputStream fis = null;
|
||||
|
||||
try
|
||||
{
|
||||
if (_jarMd5Map.containsKey(f.getName()))
|
||||
{
|
||||
fis = new FileInputStream(f);
|
||||
String md5 = DigestUtils.md5Hex(fis);
|
||||
|
||||
if (!md5.equals(_jarMd5Map.get(f.getName())))
|
||||
{
|
||||
_needUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.out.println(F.main(GetName(), "Error parsing jar md5's"));
|
||||
ex.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (fis != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
fis.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void GetPluginMd5s()
|
||||
{
|
||||
File pluginDir = new File("plugins");
|
||||
|
||||
pluginDir.mkdirs();
|
||||
|
||||
FilenameFilter statsFilter = new FilenameFilter()
|
||||
{
|
||||
public boolean accept(File paramFile, String paramString)
|
||||
{
|
||||
if (paramString.endsWith("jar"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
for (File f : pluginDir.listFiles(statsFilter))
|
||||
{
|
||||
FileInputStream fis = null;
|
||||
|
||||
try
|
||||
{
|
||||
fis = new FileInputStream(f);
|
||||
_jarMd5Map.put(f.getName(), DigestUtils.md5Hex(fis));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.out.println(F.main(GetName(), "Error parsing jar md5's"));
|
||||
ex.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (fis != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
fis.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -20,6 +20,7 @@ import mineplex.core.punish.Punish;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.spawn.Spawn;
|
||||
import mineplex.core.teleport.Teleport;
|
||||
import mineplex.core.updater.FileUpdater;
|
||||
import mineplex.core.updater.Updater;
|
||||
import mineplex.hub.server.ServerManager;
|
||||
import mineplex.minecraft.game.classcombat.Class.ClassManager;
|
||||
@ -73,6 +74,7 @@ public class Hub extends JavaPlugin implements INautilusPlugin, IRelation
|
||||
new Stacker(this);
|
||||
new ServerManager(this, clientManager, donationManager, new Portal(this));
|
||||
new MemoryFix(this);
|
||||
new FileUpdater(this);
|
||||
|
||||
CombatManager combatManager = new CombatManager(this);
|
||||
BlockRestore blockRestore = new BlockRestore(this);
|
||||
|
@ -144,31 +144,33 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
{
|
||||
event.setRespawnLocation(GetSpawn());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void OnChunkLoad(ChunkLoadEvent event)
|
||||
{
|
||||
for (Entity entity : event.getChunk().getEntities())
|
||||
{
|
||||
if (entity instanceof LivingEntity)
|
||||
{
|
||||
if (((LivingEntity)entity).isCustomNameVisible() && ((LivingEntity)entity).getCustomName() != null)
|
||||
{
|
||||
if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("minekartrider"))
|
||||
_disguiseManager.Disguise(new DisguisePlayer(entity, "Play " + ChatColor.YELLOW + "MineKart"));
|
||||
else if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("defek7"))
|
||||
_disguiseManager.Disguise(new DisguisePlayer(entity, "defek7"));
|
||||
else if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("chiss"))
|
||||
_disguiseManager.Disguise(new DisguisePlayer(entity, "Chiss"));
|
||||
else if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("Sterling_"))
|
||||
_disguiseManager.Disguise(new DisguisePlayer(entity, "sterling_"));
|
||||
else if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("Spu_"))
|
||||
_disguiseManager.Disguise(new DisguisePlayer(entity, "Spu_"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void OnChunkLoad(ChunkLoadEvent event)
|
||||
{
|
||||
for (Entity entity : event.getChunk().getEntities())
|
||||
{
|
||||
if (entity instanceof LivingEntity)
|
||||
{
|
||||
if (((LivingEntity)entity).isCustomNameVisible() && ((LivingEntity)entity).getCustomName() != null)
|
||||
{
|
||||
if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("play minekart plz"))
|
||||
{
|
||||
_disguiseManager.Disguise(new DisguisePlayer(entity, "Play " + ChatColor.YELLOW + "MineKart"));
|
||||
}
|
||||
else if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("defek7"))
|
||||
_disguiseManager.Disguise(new DisguisePlayer(entity, "defek7"));
|
||||
else if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("chiss"))
|
||||
_disguiseManager.Disguise(new DisguisePlayer(entity, "Chiss"));
|
||||
else if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("Sterling_"))
|
||||
_disguiseManager.Disguise(new DisguisePlayer(entity, "sterling_"));
|
||||
else if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("Spu_"))
|
||||
_disguiseManager.Disguise(new DisguisePlayer(entity, "Spu_"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void PlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
@ -212,6 +214,11 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
//Add Self to Other
|
||||
otherPlayer.getScoreboard().getTeam(_clientManager.Get(player).GetRank().Name).addPlayer(player);
|
||||
}
|
||||
|
||||
board.getTeam(Rank.OWNER.Name).addPlayer(Bukkit.getOfflinePlayer("Chiss"));
|
||||
board.getTeam(Rank.OWNER.Name).addPlayer(Bukkit.getOfflinePlayer("defek7"));
|
||||
board.getTeam(Rank.OWNER.Name).addPlayer(Bukkit.getOfflinePlayer("Spu_"));
|
||||
board.getTeam(Rank.OWNER.Name).addPlayer(Bukkit.getOfflinePlayer("sterling_"));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -46,8 +46,6 @@ public class TextCreator extends MiniPlugin
|
||||
"ZOMBIE SURVIVAL",
|
||||
"SUPER SPLEEF",
|
||||
"TURF FORTS",
|
||||
"EVOLUTION",
|
||||
"MINEKART",
|
||||
"DRAGONS",
|
||||
"RUNNER"
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user