Whoops! Fixed something in ArenaManager.java. Thanks desmin!
This commit is contained in:
Binary file not shown.
@@ -109,13 +109,13 @@ public class ArenaManager
|
|||||||
dCreepers = MAUtils.getDistribution("creepers");
|
dCreepers = MAUtils.getDistribution("creepers");
|
||||||
dWolves = MAUtils.getDistribution("wolves");
|
dWolves = MAUtils.getDistribution("wolves");
|
||||||
|
|
||||||
dPigZombies = MAUtils.getDistribution("poweredcreepers", "special");
|
dPoweredCreepers = MAUtils.getDistribution("poweredcreepers", "special");
|
||||||
dPigZombies = MAUtils.getDistribution("zombiepigmen", "special");
|
dPigZombies = MAUtils.getDistribution("zombiepigmen", "special");
|
||||||
dSlimes = MAUtils.getDistribution("slimes", "special");
|
dSlimes = MAUtils.getDistribution("slimes", "special");
|
||||||
dMonsters = MAUtils.getDistribution("humans", "special");
|
dMonsters = MAUtils.getDistribution("humans", "special");
|
||||||
dAngryWolves = MAUtils.getDistribution("angrywolves", "special");
|
dAngryWolves = MAUtils.getDistribution("angrywolves", "special");
|
||||||
dGiants = MAUtils.getDistribution("giants", "special");
|
dGiants = MAUtils.getDistribution("giants", "special");
|
||||||
dGhasts = MAUtils.getDistribution("ghasts", "special");
|
dGhasts = MAUtils.getDistribution("ghasts", "special");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convenience variables.
|
// Convenience variables.
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
package com.garbagemule.MobArena;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.player.PlayerListener;
|
|
||||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
|
||||||
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This listener prevents players from sharing class-specific
|
|
||||||
* items (read: cheating) before the arena session starts.
|
|
||||||
*/
|
|
||||||
// TO-DO: Merge with MASignListener and MAReadyListener into MALobbyListener
|
|
||||||
public class MADropListener extends PlayerListener
|
|
||||||
{
|
|
||||||
private MobArena plugin;
|
|
||||||
|
|
||||||
public MADropListener(MobArena instance)
|
|
||||||
{
|
|
||||||
plugin = instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onPlayerDropItem(PlayerDropItemEvent event)
|
|
||||||
{
|
|
||||||
Player p = event.getPlayer();
|
|
||||||
if (ArenaManager.playerSet.contains(p))
|
|
||||||
{
|
|
||||||
if (ArenaManager.isRunning)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ArenaManager.tellPlayer(p, "No sharing before the arena starts!");
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
package com.garbagemule.MobArena;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.player.PlayerListener;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This listener flags players as ready, if they are in the arena
|
|
||||||
* session, and hit an iron block (id: 42).
|
|
||||||
*/
|
|
||||||
// TO-DO: Merge with MASignListener and MADropListener into MALobbyListener
|
|
||||||
// TO-DO: Let server host decide which type of block is the "readyblock".
|
|
||||||
public class MAReadyListener extends PlayerListener
|
|
||||||
{
|
|
||||||
private MobArena plugin;
|
|
||||||
|
|
||||||
public MAReadyListener(MobArena instance)
|
|
||||||
{
|
|
||||||
plugin = instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onPlayerInteract(PlayerInteractEvent event)
|
|
||||||
{
|
|
||||||
Player p = event.getPlayer();
|
|
||||||
if (ArenaManager.playerSet.contains(p))
|
|
||||||
{
|
|
||||||
if ((event.hasBlock()) && (event.getClickedBlock().getTypeId() == 42))
|
|
||||||
{
|
|
||||||
if (ArenaManager.classMap.containsKey(p))
|
|
||||||
{
|
|
||||||
ArenaManager.tellPlayer(p, "You have been flagged as ready!");
|
|
||||||
ArenaManager.playerReady(p);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ArenaManager.tellPlayer(p, "You must first pick a class!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
package com.garbagemule.MobArena;
|
|
||||||
|
|
||||||
import org.bukkit.block.Sign;
|
|
||||||
import org.bukkit.event.Event.Result;
|
|
||||||
import org.bukkit.event.block.Action;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.player.PlayerListener;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This listener handles the class assignments. When a player in
|
|
||||||
* the arena session hits a class sign, they will be given their
|
|
||||||
* class-specific items.
|
|
||||||
*/
|
|
||||||
// TO-DO: Merge with MAReadyListener and MADropListener into MALobbyListener
|
|
||||||
public class MASignListener extends PlayerListener
|
|
||||||
{
|
|
||||||
private MobArena plugin;
|
|
||||||
|
|
||||||
public MASignListener(MobArena instance)
|
|
||||||
{
|
|
||||||
plugin = instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onPlayerInteract(PlayerInteractEvent event)
|
|
||||||
{
|
|
||||||
// Only do these checks if the arena isn't running.
|
|
||||||
if (!ArenaManager.isRunning)
|
|
||||||
{
|
|
||||||
Action a = event.getAction();
|
|
||||||
Player p = event.getPlayer();
|
|
||||||
|
|
||||||
// Check if player is trying to use an item.
|
|
||||||
// TO-DO: Find a way to allow right-click. Perhaps just remove the return;
|
|
||||||
if ((a == Action.RIGHT_CLICK_AIR) || (a == Action.RIGHT_CLICK_BLOCK))
|
|
||||||
{
|
|
||||||
if (ArenaManager.playerSet.contains(p))
|
|
||||||
event.setUseItemInHand(Result.DENY);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if the clicked block is one of the class signs.
|
|
||||||
if ((event.hasBlock()) && (event.getClickedBlock().getState() instanceof Sign))
|
|
||||||
{
|
|
||||||
// Cast the block to a sign to get the text on it.
|
|
||||||
Sign sign = (Sign) event.getClickedBlock().getState();
|
|
||||||
|
|
||||||
if (ArenaManager.playerSet.contains(p))
|
|
||||||
{
|
|
||||||
// Check if the first line of the sign is a class name.
|
|
||||||
String className = sign.getLine(0);
|
|
||||||
if (ArenaManager.classes.contains(className))
|
|
||||||
{
|
|
||||||
// Set the player's class.
|
|
||||||
ArenaManager.assignClass(p, className);
|
|
||||||
ArenaManager.tellPlayer(p, "You have chosen " + className + " as your class!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -110,7 +110,6 @@ public class MAUtils
|
|||||||
{
|
{
|
||||||
id = Integer.parseInt(item[0]);
|
id = Integer.parseInt(item[0]);
|
||||||
stack = new ItemStack(id, amount);
|
stack = new ItemStack(id, amount);
|
||||||
//if (!reward && Arrays.asList(SWORDS_ID).contains(id))
|
|
||||||
if (!reward && SWORDS_ID.contains(id))
|
if (!reward && SWORDS_ID.contains(id))
|
||||||
stack.setDurability((short)-3276);
|
stack.setDurability((short)-3276);
|
||||||
}
|
}
|
||||||
@@ -118,7 +117,6 @@ public class MAUtils
|
|||||||
{
|
{
|
||||||
stack = makeItemStack(item[0], amount);
|
stack = makeItemStack(item[0], amount);
|
||||||
if (stack == null) continue;
|
if (stack == null) continue;
|
||||||
//if (!reward && Arrays.asList(SWORDS_TYPE).contains(stack.getType()))
|
|
||||||
if (!reward && SWORDS_ID.contains(stack.getTypeId()))
|
if (!reward && SWORDS_ID.contains(stack.getTypeId()))
|
||||||
stack.setDurability((short)-3276);
|
stack.setDurability((short)-3276);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user