Fix a server exception causing death to not drop items
This commit is contained in:
parent
e9115fba74
commit
2b09531523
1 changed files with 17 additions and 2 deletions
|
@ -27,7 +27,15 @@ public class DeathMessages {
|
|||
public static String getRandomDeathMessage(Profile playerWhoDied, DamageSource source)
|
||||
{
|
||||
Random rng = new Random();
|
||||
int msg = rng.nextInt(0, messages.size()-1);
|
||||
int msg = 0;
|
||||
try {
|
||||
msg = rng.nextInt(0, messages.size()-1);
|
||||
|
||||
}catch (Exception E)
|
||||
{
|
||||
E.printStackTrace();
|
||||
msg=0;
|
||||
}
|
||||
String sourceName="";
|
||||
if(source.isCreativePlayer())
|
||||
{
|
||||
|
@ -35,7 +43,14 @@ public class DeathMessages {
|
|||
}
|
||||
if(source.is(DamageTypes.FALL))
|
||||
{
|
||||
msg = rng.nextInt(0,messages_falling.size()-1);
|
||||
try {
|
||||
msg = rng.nextInt(0,messages_falling.size()-1);
|
||||
|
||||
}catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
msg=0;
|
||||
}
|
||||
return ChatHelpers.macroize(messages_falling.get(msg), String.valueOf(playerWhoDied.deaths), playerWhoDied.name_color + playerWhoDied.nickname);
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue