Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex

Conflicts:
	Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java
This commit is contained in:
Chiss 2014-06-13 08:42:57 +10:00
commit 2170f743dd
7 changed files with 112 additions and 20 deletions

View File

@ -50,7 +50,7 @@ public class Chat extends MiniPlugin
private PreferencesManager _preferences;
private String _filterUrl = "https://mp9wbhy6.pottymouthfilter.com/v1/";
private String _apiKey = "38SMwIOeymi8V3r2MVtJ";
private String _apiKey = "oUywMpwZcIzZO5AWnfDx";
private String _authName = "";
private String _serverName;

View File

@ -80,7 +80,7 @@ public class PreferencesManager extends MiniClientPlugin<UserPreferences>
if (event.getType() != UpdateType.SLOW)
return;
NautHashMap<String, UserPreferences> bufferCopy = new NautHashMap<String, UserPreferences>();
final NautHashMap<String, UserPreferences> bufferCopy = new NautHashMap<String, UserPreferences>();
for (Entry<String, UserPreferences> entry : _saveBuffer.entrySet())
{
@ -89,8 +89,14 @@ public class PreferencesManager extends MiniClientPlugin<UserPreferences>
_saveBuffer.clear();
GetPlugin().getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
{
public void run()
{
_repository.saveUserPreferences(bufferCopy);
}
});
}
@EventHandler
public void givePlayerItem(PlayerJoinEvent event)

View File

@ -23,13 +23,14 @@ public class SimpleStats extends MiniPlugin
_repository.initialize();
}
/*
public NautHashMap<String, String> getEntries()
{
synchronized (_transferLock)
{
return _entries;
}
}
}*/
@EventHandler
public void storeStatsUpdate(final UpdateEvent updateEvent)
@ -65,4 +66,22 @@ public class SimpleStats extends MiniPlugin
}
});
}
public NautHashMap<String, String> getStat(String statName)
{
final String statNameFinal = statName;
Bukkit.getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
{
public void run()
{
synchronized (_transferLock)
{
_entries = _repository.retrieveStat(statNameFinal);
}
}
});
return _entries;
}
}

View File

@ -17,8 +17,9 @@ public class SimpleStatsRepository
private String _password = "tAbechAk3wR7tuTh"; //try to obfuscate this in the future!
private static String CREATE_STATS_TABLE = "CREATE TABLE IF NOT EXISTS simpleStats (id INT NOT NULL AUTO_INCREMENT, statName VARCHAR(64), statValue VARCHAR(64), PRIMARY KEY (id));";
private static String RETRIEVE_STATS_RECORDS = "SELECT statName.*, statValue.* FROM simpleStats;";
private static String STORE_STATS_RECORD = "INSERT INTO simpleStats (statName,statValue) VALUES(";
private static String RETRIEVE_STATS_RECORDS = "SELECT simpleStats.statName, simpleStats.statValue FROM simpleStats;";
private static String STORE_STATS_RECORD = "INSERT INTO simpleStats (statName,statValue) VALUES(?,?);";
private static String RETRIEVE_STAT_RECORD = "SELECT simpleStats.statName, simpleStats.statValue FROM simpleStats WHERE statName = '?';";
private Connection _connection = null;
@ -128,7 +129,9 @@ public class SimpleStatsRepository
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
}
preparedStatement = _connection.prepareStatement(STORE_STATS_RECORD + statName + "," + statValue + ");");
preparedStatement = _connection.prepareStatement(STORE_STATS_RECORD);
preparedStatement.setString(1, statName);
preparedStatement.setString(2, statValue);
preparedStatement.executeUpdate();
}
@ -152,4 +155,64 @@ public class SimpleStatsRepository
}
}
}
public NautHashMap<String, String> retrieveStat(String statName)
{
ResultSet resultSet = null;
PreparedStatement preparedStatement = null;
NautHashMap<String, String> statRecords = new NautHashMap<String, String>();
try
{
synchronized (_connectionLock)
{
if (_connection.isClosed())
{
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
}
preparedStatement = _connection.prepareStatement(RETRIEVE_STAT_RECORD);
preparedStatement.setString(1, statName);
resultSet = preparedStatement.executeQuery();
while (resultSet.next())
{
statRecords.put(resultSet.getString(1), resultSet.getString(2));
}
}
}
catch (Exception exception)
{
exception.printStackTrace();
}
finally
{
if (preparedStatement != null)
{
try
{
preparedStatement.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
if (resultSet != null)
{
try
{
resultSet.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
}
return statRecords;
}
}

View File

@ -53,12 +53,13 @@ public class WelcomeTutorial extends Tutorial
"Survival",
new String[]
{
"This is the " + _elem + "The Bridges" + _main + " game mode.",
"This is a great team combat game.",
"You get 10 minutes to prepare for battle,",
"then the bridges drop, and you fight to the death!",
"Here are the " + _elem + "Survival" + _main + " game modes.",
"",
_elem + "Hunger Games" + _main + " will be added here soon!"
_elem + "The Bridges" + _main + ", you get 10 minutes to prepare",
"then the Bridges drop, and battle starts!",
"",
_elem + "Survival Games" + _main + " puts you into a dangerous",
"battle for survival against 23 other tributes!"
}
));
@ -84,11 +85,15 @@ public class WelcomeTutorial extends Tutorial
{
"Here, you can play our " + _elem + "Classics" + _main + " game modes.",
"",
_elem + "MineKart" + _main + " is an exciting racing game.",
"Complete with weapons, drifting and more!",
"",
"In " + _elem + "Super Smash Mobs" + _main + " you become a monster,",
"then fight to the death with other players, using fun skills!"
"then fight to the death with other players, using fun skills!",
"",
_elem + "Draw My Thing" + _main + " is a drawing game where players",
"take turns at drawing and guessing the word.",
//"",
//"In " + _elem + "Block Hunt" + _main + " you turn into a block",
//"and hide from the Hunters until the time is up!",
}
));
@ -120,7 +125,7 @@ public class WelcomeTutorial extends Tutorial
"The easiest way is to walk through the portal.",
"This will join the best available server!",
"",
"Click the " + _elem + "Wither Skeleton" + _main + " to open the " + _elem + "Server Menu" + _main + ".",
"Click the " + _elem + "Game NPC" + _main + " to open the " + _elem + "Server Menu" + _main + ".",
"Here, you can manually pick which server to join!",
}
));

View File

@ -266,7 +266,7 @@ public class DamageManager extends MiniPlugin
event.GetCause() == DamageCause.PROJECTILE ||
event.GetCause() == DamageCause.CUSTOM
))// && event.GetDamage() > 2)
bruteBonus = Math.min(8, event.GetDamage());
bruteBonus = Math.min(8, event.GetDamage()*2);
//Do Damage
HandleDamage(event.GetDamageeEntity(), event.GetDamagerEntity(true), event.GetCause(), (float)(event.GetDamage() + bruteBonus), event.IgnoreArmor());

View File

@ -80,7 +80,6 @@ public class Arcade extends JavaPlugin implements INautilusPlugin
PreferencesManager preferenceManager = new PreferencesManager(this, _clientManager, _donationManager);
new MessageManager(this, _clientManager, preferenceManager);
AntiStack antistack = new AntiStack(this);
Creature creature = new Creature(this);