GIT SUCKS MONKEY NUTS!
This commit is contained in:
@@ -40,6 +40,7 @@ import org.bukkit.entity.Slime;
|
|||||||
import org.bukkit.entity.Wolf;
|
import org.bukkit.entity.Wolf;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
|
import org.bukkit.permissions.PermissionAttachment;
|
||||||
import org.bukkit.util.config.Configuration;
|
import org.bukkit.util.config.Configuration;
|
||||||
|
|
||||||
import com.garbagemule.MobArena.MAMessages.Msg;
|
import com.garbagemule.MobArena.MAMessages.Msg;
|
||||||
@@ -72,6 +73,8 @@ public class Arena
|
|||||||
protected Map<Integer,List<ItemStack>> everyWaveMap, afterWaveMap;
|
protected Map<Integer,List<ItemStack>> everyWaveMap, afterWaveMap;
|
||||||
protected Map<Player,String> classMap;
|
protected Map<Player,String> classMap;
|
||||||
protected Map<String,List<ItemStack>> classItems, classArmor;
|
protected Map<String,List<ItemStack>> classItems, classArmor;
|
||||||
|
protected Map<String,List<String>> classPerms;
|
||||||
|
protected Map<Player,List<PermissionAttachment>> attachments;
|
||||||
protected List<ItemStack> entryFee;
|
protected List<ItemStack> entryFee;
|
||||||
|
|
||||||
// Player sets
|
// Player sets
|
||||||
@@ -137,6 +140,7 @@ public class Arena
|
|||||||
randoms = new HashSet<Player>();
|
randoms = new HashSet<Player>();
|
||||||
repairables = new LinkedList<Repairable>();
|
repairables = new LinkedList<Repairable>();
|
||||||
containables = new LinkedList<Repairable>();
|
containables = new LinkedList<Repairable>();
|
||||||
|
attachments = new HashMap<Player,List<PermissionAttachment>>();
|
||||||
|
|
||||||
running = false;
|
running = false;
|
||||||
edit = false;
|
edit = false;
|
||||||
@@ -176,6 +180,7 @@ public class Arena
|
|||||||
{
|
{
|
||||||
p.teleport(arenaLoc);
|
p.teleport(arenaLoc);
|
||||||
p.setHealth(20);
|
p.setHealth(20);
|
||||||
|
assignClassPermissions(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy the singleWaves Set for polling.
|
// Copy the singleWaves Set for polling.
|
||||||
@@ -197,6 +202,7 @@ public class Arena
|
|||||||
|
|
||||||
// Announce and notify.
|
// Announce and notify.
|
||||||
MAUtils.tellAll(this, Msg.ARENA_START);
|
MAUtils.tellAll(this, Msg.ARENA_START);
|
||||||
|
|
||||||
for (MobArenaListener listener : plugin.getAM().listeners)
|
for (MobArenaListener listener : plugin.getAM().listeners)
|
||||||
listener.onArenaStart(this);
|
listener.onArenaStart(this);
|
||||||
|
|
||||||
@@ -244,7 +250,6 @@ public class Arena
|
|||||||
notifyPlayers.clear();
|
notifyPlayers.clear();
|
||||||
rewardedPlayers.clear();
|
rewardedPlayers.clear();
|
||||||
classMap.clear();
|
classMap.clear();
|
||||||
spawnThread = null;
|
|
||||||
|
|
||||||
// Notify listeners.
|
// Notify listeners.
|
||||||
for (MobArenaListener listener : plugin.getAM().listeners)
|
for (MobArenaListener listener : plugin.getAM().listeners)
|
||||||
@@ -322,7 +327,7 @@ public class Arena
|
|||||||
|
|
||||||
public void playerLeave(Player p)
|
public void playerLeave(Player p)
|
||||||
{
|
{
|
||||||
finishArenaPlayer(p);
|
finishArenaPlayer(p, false);
|
||||||
movePlayerToEntry(p);
|
movePlayerToEntry(p);
|
||||||
discardPlayer(p);
|
discardPlayer(p);
|
||||||
|
|
||||||
@@ -336,7 +341,7 @@ public class Arena
|
|||||||
|
|
||||||
public void playerDeath(Player p)
|
public void playerDeath(Player p)
|
||||||
{
|
{
|
||||||
finishArenaPlayer(p);
|
finishArenaPlayer(p, true);
|
||||||
|
|
||||||
if (specOnDeath)
|
if (specOnDeath)
|
||||||
{
|
{
|
||||||
@@ -477,7 +482,7 @@ public class Arena
|
|||||||
log.players.get(p).kills++;
|
log.players.get(p).kills++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void restoreInvAndGiveRewards(final Player p)
|
public void restoreInvAndGiveRewardsDelayed(final Player p)
|
||||||
{
|
{
|
||||||
final List<ItemStack> rewards = log != null && log.players.get(p) != null ? log.players.get(p).rewards : new LinkedList<ItemStack>();
|
final List<ItemStack> rewards = log != null && log.players.get(p) != null ? log.players.get(p).rewards : new LinkedList<ItemStack>();
|
||||||
final boolean hadRewards = rewardedPlayers.contains(p);
|
final boolean hadRewards = rewardedPlayers.contains(p);
|
||||||
@@ -500,20 +505,22 @@ public class Arena
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void restoreInvAndGiveRewardz(final Player p, List<ItemStack> rewards, boolean hadRewards)
|
public void restoreInvAndGiveRewards(final Player p)
|
||||||
{
|
{
|
||||||
if (!p.isOnline())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!emptyInvJoin)
|
if (!emptyInvJoin)
|
||||||
MAUtils.restoreInventory(p);
|
MAUtils.restoreInventory(p);
|
||||||
|
|
||||||
if (hadRewards)
|
if (rewardedPlayers.contains(p))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
final List<ItemStack> rewards = (log != null && log.players.get(p) != null) ?
|
||||||
|
log.players.get(p).rewards :
|
||||||
|
new LinkedList<ItemStack>();
|
||||||
|
|
||||||
MAUtils.giveRewards(p, rewards, plugin);
|
MAUtils.giveRewards(p, rewards, plugin);
|
||||||
if (running)
|
if (running)
|
||||||
rewardedPlayers.add(p);}
|
rewardedPlayers.add(p);
|
||||||
|
}
|
||||||
|
|
||||||
public void storePlayerData(Player p, Location loc)
|
public void storePlayerData(Player p, Location loc)
|
||||||
{
|
{
|
||||||
@@ -612,15 +619,19 @@ public class Arena
|
|||||||
/**
|
/**
|
||||||
* Give the player back his inventory and record his last wave.
|
* Give the player back his inventory and record his last wave.
|
||||||
* Called when a player dies or leaves prematurely.
|
* Called when a player dies or leaves prematurely.
|
||||||
* @param p
|
* @param p A player
|
||||||
|
* @param dead If the player died or not
|
||||||
*/
|
*/
|
||||||
private void finishArenaPlayer(Player p)
|
private void finishArenaPlayer(Player p, boolean dead)
|
||||||
{
|
{
|
||||||
if (!arenaPlayers.contains(p) && !lobbyPlayers.contains(p))
|
if (!arenaPlayers.contains(p) && !lobbyPlayers.contains(p))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
removeClassPermissions(p);
|
||||||
MAUtils.clearInventory(p);
|
MAUtils.clearInventory(p);
|
||||||
restoreInvAndGiveRewards(p);
|
|
||||||
|
if (dead) restoreInvAndGiveRewardsDelayed(p);
|
||||||
|
else restoreInvAndGiveRewards(p);
|
||||||
|
|
||||||
if (log != null && spawnThread != null)
|
if (log != null && spawnThread != null)
|
||||||
log.players.get(p).lastWave = spawnThread.getWave() - 1;
|
log.players.get(p).lastWave = spawnThread.getWave() - 1;
|
||||||
@@ -629,12 +640,10 @@ public class Arena
|
|||||||
public void repairBlocks()
|
public void repairBlocks()
|
||||||
{
|
{
|
||||||
//long start = System.nanoTime();
|
//long start = System.nanoTime();
|
||||||
//System.out.println(start + " - Attempting to repair things...");
|
|
||||||
while (!repairQueue.isEmpty())
|
while (!repairQueue.isEmpty())
|
||||||
{
|
{
|
||||||
repairQueue.poll().repair();
|
repairQueue.poll().repair();
|
||||||
}
|
}
|
||||||
//System.out.println(start + " - Repair finished!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void queueRepairable(Repairable r)
|
public void queueRepairable(Repairable r)
|
||||||
@@ -693,6 +702,29 @@ public class Arena
|
|||||||
MAUtils.tellPlayer(p, Msg.LOBBY_CLASS_PICKED, className);
|
MAUtils.tellPlayer(p, Msg.LOBBY_CLASS_PICKED, className);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void assignClassPermissions(Player p)
|
||||||
|
{
|
||||||
|
Configuration config = plugin.getConfig();
|
||||||
|
String clazz = classMap.get(p);
|
||||||
|
String path = "classes." + clazz + ".permissions.";
|
||||||
|
|
||||||
|
List<String> permissions = classPerms.get(classMap.get(p));
|
||||||
|
if (permissions == null || permissions.isEmpty()) return;
|
||||||
|
|
||||||
|
attachments.put(p, new LinkedList<PermissionAttachment>());
|
||||||
|
for (String perm : permissions)
|
||||||
|
attachments.get(p).add(p.addAttachment(plugin, perm, config.getBoolean(path + perm, true)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeClassPermissions(Player p)
|
||||||
|
{
|
||||||
|
if (attachments.get(p) == null) return;
|
||||||
|
|
||||||
|
for (PermissionAttachment pa : attachments.get(p))
|
||||||
|
if (pa != null)
|
||||||
|
pa.remove();
|
||||||
|
}
|
||||||
|
|
||||||
private void cleanup()
|
private void cleanup()
|
||||||
{
|
{
|
||||||
removeMonsters();
|
removeMonsters();
|
||||||
@@ -827,6 +859,7 @@ public class Arena
|
|||||||
classes = plugin.getAM().classes;
|
classes = plugin.getAM().classes;
|
||||||
classItems = plugin.getAM().classItems;
|
classItems = plugin.getAM().classItems;
|
||||||
classArmor = plugin.getAM().classArmor;
|
classArmor = plugin.getAM().classArmor;
|
||||||
|
classPerms = plugin.getAM().classPerms;
|
||||||
|
|
||||||
// Determine if the arena is properly set up. Then add the to arena list.
|
// Determine if the arena is properly set up. Then add the to arena list.
|
||||||
setup = MAUtils.verifyData(this);
|
setup = MAUtils.verifyData(this);
|
||||||
@@ -1194,7 +1227,8 @@ public class Arena
|
|||||||
// Economy money
|
// Economy money
|
||||||
if (stack.getTypeId() == MobArena.ECONOMY_MONEY_ID)
|
if (stack.getTypeId() == MobArena.ECONOMY_MONEY_ID)
|
||||||
{
|
{
|
||||||
if (plugin.Methods.hasMethod() && !plugin.Method.getAccount(p.getName()).hasEnough(stack.getAmount()))
|
//if (plugin.Methods.hasMethod() && !plugin.Method.getAccount(p.getName()).hasEnough(stack.getAmount()))
|
||||||
|
if (plugin.Methods.hasMethod() && !(plugin.Method.getAccount(p.getName()).balance() >= stack.getAmount()))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Normal stack
|
// Normal stack
|
||||||
@@ -1253,9 +1287,9 @@ public class Arena
|
|||||||
MAUtils.tellPlayer(p, Msg.JOIN_TOO_FAR);
|
MAUtils.tellPlayer(p, Msg.JOIN_TOO_FAR);
|
||||||
else if (emptyInvJoin && !MAUtils.hasEmptyInventory(p))
|
else if (emptyInvJoin && !MAUtils.hasEmptyInventory(p))
|
||||||
MAUtils.tellPlayer(p, Msg.JOIN_EMPTY_INV);
|
MAUtils.tellPlayer(p, Msg.JOIN_EMPTY_INV);
|
||||||
/*else if (!canAfford(p) || !takeFee(p))
|
else if (!canAfford(p))// || !takeFee(p))
|
||||||
MAUtils.tellPlayer(p, Msg.JOIN_FEE_REQUIRED, MAUtils.listToString(entryFee, plugin));
|
MAUtils.tellPlayer(p, Msg.JOIN_FEE_REQUIRED, MAUtils.listToString(entryFee, plugin));
|
||||||
else if (emptyInvJoin && !MAUtils.hasEmptyInventory(p))
|
/*else if (emptyInvJoin && !MAUtils.hasEmptyInventory(p))
|
||||||
MAUtils.tellPlayer(p, Msg.JOIN_EMPTY_INV);
|
MAUtils.tellPlayer(p, Msg.JOIN_EMPTY_INV);
|
||||||
else if (!emptyInvJoin && !MAUtils.storeInventory(p))
|
else if (!emptyInvJoin && !MAUtils.storeInventory(p))
|
||||||
MAUtils.tellPlayer(p, Msg.JOIN_STORE_INV_FAIL);*/
|
MAUtils.tellPlayer(p, Msg.JOIN_STORE_INV_FAIL);*/
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ public class ArenaMaster //implements Master
|
|||||||
// Classes
|
// Classes
|
||||||
protected List<String> classes;
|
protected List<String> classes;
|
||||||
protected Map<String,List<ItemStack>> classItems, classArmor;
|
protected Map<String,List<ItemStack>> classItems, classArmor;
|
||||||
protected Map<Integer,Map<Player,List<ItemStack>>> classBonuses;
|
protected Map<String,List<String>> classPerms;
|
||||||
|
//protected Map<Integer,Map<Player,List<ItemStack>>> classBonuses;
|
||||||
protected Map<Player,Arena> arenaMap;
|
protected Map<Player,Arena> arenaMap;
|
||||||
|
|
||||||
// Location map
|
// Location map
|
||||||
@@ -219,9 +220,10 @@ public class ArenaMaster //implements Master
|
|||||||
config.setProperty("classes.Chef.items", "stone_sword, bread:6, grilled_pork:4, mushroom_soup, cake:3, cookie:12");
|
config.setProperty("classes.Chef.items", "stone_sword, bread:6, grilled_pork:4, mushroom_soup, cake:3, cookie:12");
|
||||||
config.setProperty("classes.Chef.armor", "314,315,316,317");
|
config.setProperty("classes.Chef.armor", "314,315,316,317");
|
||||||
}
|
}
|
||||||
classes = config.getKeys("classes");
|
classes = config.getKeys("classes");
|
||||||
classItems = MAUtils.getClassItems(config, "items");
|
classItems = MAUtils.getClassItems(config, "items");
|
||||||
classArmor = MAUtils.getClassItems(config, "armor");
|
classArmor = MAUtils.getClassItems(config, "armor");
|
||||||
|
classPerms = MAUtils.getClassPerms(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -205,6 +205,18 @@ public class MAUtils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Map<String,List<String>> getClassPerms(Configuration config)
|
||||||
|
{
|
||||||
|
Map<String,List<String>> result = new HashMap<String,List<String>>();
|
||||||
|
List<String> classes = config.getKeys("classes");
|
||||||
|
if (classes == null) return result;
|
||||||
|
|
||||||
|
for (String c : classes)
|
||||||
|
result.put(c, config.getKeys("classes." + c + ".permissions"));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public static List<ItemStack> getEntryFee(Configuration config, String arena)
|
public static List<ItemStack> getEntryFee(Configuration config, String arena)
|
||||||
{
|
{
|
||||||
return makeItemStackList(config.getString("arenas." + arena + ".settings.entry-fee", null));
|
return makeItemStackList(config.getString("arenas." + arena + ".settings.entry-fee", null));
|
||||||
@@ -374,7 +386,7 @@ public class MAUtils
|
|||||||
|
|
||||||
// If the player isn't online, hack the playerName.dat file
|
// If the player isn't online, hack the playerName.dat file
|
||||||
if (!p.isOnline())
|
if (!p.isOnline())
|
||||||
return writeInventoryData(p, stacks);
|
System.out.println("FUCKKKKKKKKKKKKKKKKKKKKKKKKKK!");//return writeInventoryData(p, stacks);
|
||||||
|
|
||||||
// Otherwise, restore the inventory directly
|
// Otherwise, restore the inventory directly
|
||||||
ItemStack[] items = new ItemStack[stacks.length-4];
|
ItemStack[] items = new ItemStack[stacks.length-4];
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import org.bukkit.entity.Player;
|
|||||||
import com.garbagemule.MobArena.waves.Wave.WaveBranch;
|
import com.garbagemule.MobArena.waves.Wave.WaveBranch;
|
||||||
import com.garbagemule.MobArena.waves.Wave.WaveType;
|
import com.garbagemule.MobArena.waves.Wave.WaveType;
|
||||||
|
|
||||||
public class MobArenaListener
|
public abstract class MobArenaListener
|
||||||
{
|
{
|
||||||
protected MobArena plugin;
|
protected MobArena plugin;
|
||||||
|
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ public class WaveUtils
|
|||||||
wellDefined = false;
|
wellDefined = false;
|
||||||
}
|
}
|
||||||
// OPTIONAL: Wave
|
// OPTIONAL: Wave
|
||||||
int wave = config.getInt(path + "wave", 0);
|
int wave = config.getInt(path + "wave", frequency);
|
||||||
if (wave < 0)
|
if (wave < 0)
|
||||||
{
|
{
|
||||||
MobArena.warning("'wave' must be greater than 0 in " + path);
|
MobArena.warning("'wave' must be greater than 0 in " + path);
|
||||||
|
|||||||
@@ -101,6 +101,13 @@ public class BossWave extends AbstractWave
|
|||||||
|
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
// Check to see if the boss is still alive. If not, end this boss wave.
|
||||||
|
if (bossCreature.isDead())
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Grab the next ability
|
// Grab the next ability
|
||||||
BossAbility ability = abilities.get(counter % abilityCount);
|
BossAbility ability = abilities.get(counter % abilityCount);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user