mirror of
https://github.com/garbagemule/MobArena.git
synced 2024-11-29 22:23:54 +01:00
Removed some unneeded imports.
Made player list generation more efficient. Removed calls to .keySet()
This commit is contained in:
parent
fe54473f6d
commit
dd29291f58
@ -1,27 +1,22 @@
|
|||||||
package com.garbagemule.MobArena;
|
package com.garbagemule.MobArena;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import org.bukkit.World;
|
import java.util.HashSet;
|
||||||
import org.bukkit.Server;
|
import java.util.List;
|
||||||
import org.bukkit.Material;
|
import java.util.Map;
|
||||||
import org.bukkit.Location;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
|
||||||
import org.bukkit.util.config.Configuration;
|
import org.bukkit.util.config.Configuration;
|
||||||
import org.bukkit.event.Event;
|
|
||||||
import org.bukkit.plugin.EventExecutor;
|
|
||||||
|
|
||||||
public class ArenaManager
|
public class ArenaManager
|
||||||
{
|
{
|
||||||
@ -220,7 +215,7 @@ public class ArenaManager
|
|||||||
|
|
||||||
playerSet.add(p);
|
playerSet.add(p);
|
||||||
|
|
||||||
if (!locationMap.keySet().contains(p))
|
if (!locationMap.containsKey(p))
|
||||||
{
|
{
|
||||||
locationMap.put(p, p.getLocation());
|
locationMap.put(p, p.getLocation());
|
||||||
}
|
}
|
||||||
@ -237,7 +232,7 @@ public class ArenaManager
|
|||||||
*/
|
*/
|
||||||
public static void playerLeave(Player p)
|
public static void playerLeave(Player p)
|
||||||
{
|
{
|
||||||
if (!locationMap.keySet().contains(p))
|
if (!locationMap.containsKey(p))
|
||||||
{
|
{
|
||||||
tellPlayer(p, "You are not in the arena.");
|
tellPlayer(p, "You are not in the arena.");
|
||||||
return;
|
return;
|
||||||
@ -329,12 +324,15 @@ public class ArenaManager
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String list = "";
|
StringBuffer list = new StringBuffer();
|
||||||
|
final String SEPARATOR = ", ";
|
||||||
for (Player player : playerSet)
|
for (Player player : playerSet)
|
||||||
list += player.getName() + ", ";
|
{
|
||||||
list = list.substring(0,list.length()-2);
|
list.append(player.getName());
|
||||||
|
list.append(SEPARATOR);
|
||||||
|
}
|
||||||
|
|
||||||
tellPlayer(p, "Survivors: " + list);
|
tellPlayer(p, "Survivors: " + list.substring(0, list.length() - 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -351,12 +349,15 @@ public class ArenaManager
|
|||||||
Set<Player> notReadySet = new HashSet<Player>(playerSet);
|
Set<Player> notReadySet = new HashSet<Player>(playerSet);
|
||||||
notReadySet.removeAll(readySet);
|
notReadySet.removeAll(readySet);
|
||||||
|
|
||||||
String list = "";
|
StringBuffer list = new StringBuffer();
|
||||||
|
final String SEPARATOR = ", ";
|
||||||
for (Player player : notReadySet)
|
for (Player player : notReadySet)
|
||||||
list += player.getName() + ", ";
|
{
|
||||||
list = list.substring(0,list.length()-2);
|
list.append(player.getName());
|
||||||
|
list.append(SEPARATOR);
|
||||||
|
}
|
||||||
|
|
||||||
tellPlayer(p, "Not ready: " + list);
|
tellPlayer(p, "Not ready: " + list.substring(0, list.length() - 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -445,7 +446,7 @@ public class ArenaManager
|
|||||||
for (Player p : rewardMap.keySet())
|
for (Player p : rewardMap.keySet())
|
||||||
{
|
{
|
||||||
String r = rewardMap.get(p);
|
String r = rewardMap.get(p);
|
||||||
if (r.equals("")) continue;
|
if (r.isEmpty()) continue;
|
||||||
|
|
||||||
tellPlayer(p, "Here are all of your rewards!");
|
tellPlayer(p, "Here are all of your rewards!");
|
||||||
MAUtils.giveItems(true, p, r);
|
MAUtils.giveItems(true, p, r);
|
||||||
|
Loading…
Reference in New Issue
Block a user