fix some format issues and implement God battles
This commit is contained in:
parent
7bd6cdb93c
commit
6c2caac800
@ -1790,7 +1790,9 @@ public abstract class Game implements Listener
|
||||
itel.remove();
|
||||
}
|
||||
}
|
||||
}@EventHandler(priority = EventPriority.HIGH)
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void teamSelectInteract(PlayerInteractEntityEvent event)
|
||||
{
|
||||
if (!PlayerTeamSelection)
|
||||
@ -1831,14 +1833,16 @@ public abstract class Game implements Listener
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
Player target = UtilPlayer.searchOnline(event.getPlayer(), event.getMessage().split(" ")[1], true);
|
||||
Player target = UtilPlayer.searchOnline(event.getPlayer(), event.getMessage().split(" ")[1],
|
||||
true);
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
//Observer
|
||||
if (Manager.IsObserver(event.getPlayer()))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Game", "Spectators cannot partake in games."));
|
||||
UtilPlayer.message(event.getPlayer(),
|
||||
F.main("Game", "Spectators cannot partake in games."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1858,8 +1862,10 @@ public abstract class Game implements Listener
|
||||
_teamReqs.remove(ally);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Game", "You accepted " + ally.getName() + "'s Team Request!"));
|
||||
UtilPlayer.message(ally, F.main("Game", player.getName() + " accepted your Team Request!"));
|
||||
UtilPlayer.message(player,
|
||||
F.main("Game", "You accepted " + ally.getName() + "'s Team Request!"));
|
||||
UtilPlayer.message(ally,
|
||||
F.main("Game", player.getName() + " accepted your Team Request!"));
|
||||
|
||||
//Leave Old Teams
|
||||
if (GetTeam(player) != null)
|
||||
@ -1886,13 +1892,16 @@ public abstract class Game implements Listener
|
||||
return;
|
||||
|
||||
//Inform Player
|
||||
UtilPlayer.message(player, F.main("Game", "You sent a Team Request to " + ally.getName() + "!"));
|
||||
UtilPlayer.message(player,
|
||||
F.main("Game", "You sent a Team Request to " + ally.getName() + "!"));
|
||||
|
||||
//Inform Target
|
||||
if (Recharge.Instance.use(player, "Team Req " + ally.getName(), 2000, false, false))
|
||||
{
|
||||
UtilPlayer.message(ally, F.main("Game", player.getName() + " sent you a Team Request!"));
|
||||
UtilPlayer.message(ally, F.main("Game", "Type " + F.elem("/team " + player.getName()) + " to accept!"));
|
||||
UtilPlayer.message(ally,
|
||||
F.main("Game", player.getName() + " sent you a Team Request!"));
|
||||
UtilPlayer.message(ally, F.main("Game",
|
||||
"Type " + F.elem("/team " + player.getName()) + " to accept!"));
|
||||
}
|
||||
|
||||
//Add Pref
|
||||
@ -1978,7 +1987,8 @@ public abstract class Game implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
GameTeam team = new GameTeam(this, getColorName(color.getColor())[e], color.getColor(), spawns, true);
|
||||
GameTeam team = new GameTeam(this, getColorName(color.getColor())[e],
|
||||
color.getColor(), spawns, true);
|
||||
team.SetVisible(true);
|
||||
GetTeamList().add(team);
|
||||
}
|
||||
@ -2013,7 +2023,8 @@ public abstract class Game implements Listener
|
||||
}
|
||||
}
|
||||
}
|
||||
GameTeam team = new GameTeam(this, getColorName(color.getColor())[e], color.getColor(), spawns, true);
|
||||
GameTeam team = new GameTeam(this, getColorName(color.getColor())[e],
|
||||
color.getColor(), spawns, true);
|
||||
team.SetVisible(true);
|
||||
GetTeamList().add(team);
|
||||
}
|
||||
@ -2034,21 +2045,24 @@ public abstract class Game implements Listener
|
||||
Location newSpawn = location.clone().add(x, 0, z);
|
||||
|
||||
//Search Downward for Solid
|
||||
while (UtilBlock.airFoliage(newSpawn.getBlock().getRelative(BlockFace.DOWN)) && newSpawn.getY() > location.getY()-5)
|
||||
while (UtilBlock.airFoliage(newSpawn.getBlock().getRelative(BlockFace.DOWN))
|
||||
&& newSpawn.getY() > location.getY() - 5)
|
||||
{
|
||||
newSpawn.subtract(0, 1, 0);
|
||||
}
|
||||
|
||||
//Move Up out of Solid
|
||||
while (!UtilBlock.airFoliage(newSpawn.getBlock()) && newSpawn.getY() < location.getY()+5)
|
||||
while (!UtilBlock.airFoliage(newSpawn.getBlock())
|
||||
&& newSpawn.getY() < location.getY() + 5)
|
||||
{
|
||||
newSpawn.add(0, 1, 0);
|
||||
}
|
||||
|
||||
//On Solid, with 2 Air Above
|
||||
if (UtilBlock.airFoliage(newSpawn.getBlock()) &&
|
||||
UtilBlock.airFoliage(newSpawn.getBlock().getRelative(BlockFace.UP)) &&
|
||||
!UtilBlock.airFoliage(newSpawn.getBlock().getRelative(BlockFace.DOWN)))
|
||||
if (UtilBlock.airFoliage(newSpawn.getBlock())
|
||||
&& UtilBlock.airFoliage(newSpawn.getBlock().getRelative(BlockFace.UP))
|
||||
&& !UtilBlock
|
||||
.airFoliage(newSpawn.getBlock().getRelative(BlockFace.DOWN)))
|
||||
{
|
||||
spawns.add(newSpawn);
|
||||
}
|
||||
@ -2109,7 +2123,8 @@ public abstract class Game implements Listener
|
||||
|
||||
private TeamColors getNextColor(TeamColors color)
|
||||
{
|
||||
for(TeamColors colors : TeamColors.values()) {
|
||||
for (TeamColors colors : TeamColors.values())
|
||||
{
|
||||
if (colors.ordinal() == color.ordinal() + 1)
|
||||
{
|
||||
return colors;
|
||||
@ -2118,8 +2133,12 @@ public abstract class Game implements Listener
|
||||
return TeamColors.YELLOW;
|
||||
}
|
||||
|
||||
public void addTutorials(){}
|
||||
public void addTutorials()
|
||||
{
|
||||
}
|
||||
|
||||
public void disable(){}
|
||||
public void disable()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -46,20 +46,23 @@ public class TwoQuiver extends Quiver
|
||||
return;
|
||||
|
||||
Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
|
||||
if (player == null) return;
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
int amount = _arrowAmount;
|
||||
|
||||
if (GetKit(player) instanceof KitSlamShot)
|
||||
{
|
||||
if (Manager.GetCondition().HasCondition(event.GetEvent().getEntity(), ConditionType.FALLING, null))
|
||||
if (Manager.GetCondition().HasCondition(event.GetEvent().getEntity(),
|
||||
ConditionType.FALLING, null))
|
||||
{
|
||||
amount++;
|
||||
}
|
||||
}
|
||||
|
||||
//New Arrow
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, amount, F.item("Super Arrow")));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte) 0, amount,
|
||||
F.item("Super Arrow")));
|
||||
player.playSound(player.getLocation(), Sound.PISTON_EXTEND, 3f, 2f);
|
||||
|
||||
//Score
|
||||
|
@ -1600,6 +1600,9 @@ public class UHC extends TeamGame
|
||||
break;
|
||||
}
|
||||
|
||||
if(visible)
|
||||
setOreType(vein);
|
||||
|
||||
// Remove Vein
|
||||
if (!visible)
|
||||
{
|
||||
@ -1622,6 +1625,11 @@ public class UHC extends TeamGame
|
||||
}
|
||||
}
|
||||
|
||||
public void setOreType(ArrayList<Block> blocks)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public boolean isMapLoaded()
|
||||
{
|
||||
return _mapLoaded;
|
||||
|
@ -29,7 +29,7 @@ public class CutClean extends UHC
|
||||
|
||||
private int _steakAmount;
|
||||
|
||||
private HashMap<Material, Material> _ores;
|
||||
private HashMap<Material, Material> _oreDrops;
|
||||
private HashMap<Material, Material> _drops;
|
||||
|
||||
public CutClean(ArcadeManager manager)
|
||||
@ -38,9 +38,9 @@ public class CutClean extends UHC
|
||||
|
||||
_steakAmount = 15;
|
||||
|
||||
_ores = new HashMap<>();
|
||||
_ores.put(Material.GOLD_ORE, Material.GOLD_INGOT);
|
||||
_ores.put(Material.IRON_ORE, Material.IRON_INGOT);
|
||||
_oreDrops = new HashMap<>();
|
||||
_oreDrops.put(Material.GOLD_ORE, Material.GOLD_INGOT);
|
||||
_oreDrops.put(Material.IRON_ORE, Material.IRON_INGOT);
|
||||
|
||||
_drops = new HashMap<>();
|
||||
_drops.put(Material.RAW_BEEF, Material.COOKED_BEEF);
|
||||
@ -58,14 +58,15 @@ public class CutClean extends UHC
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
UtilInv.insert(player, ItemStackFactory.Instance.CreateStack(Material.COOKED_BEEF, _steakAmount));
|
||||
UtilInv.insert(player,
|
||||
ItemStackFactory.Instance.CreateStack(Material.COOKED_BEEF, _steakAmount));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void smeltOres(BlockBreakEvent event)
|
||||
{
|
||||
for(Material mat : _ores.keySet())
|
||||
for (Material mat : _oreDrops.keySet())
|
||||
{
|
||||
if (event.getBlock().getType() == mat)
|
||||
{
|
||||
@ -77,9 +78,12 @@ public class CutClean extends UHC
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
event.getBlock().getWorld().dropItem(event.getBlock().getLocation().add(0.5, 0.2, 0.5), new ItemStack(_ores.get(mat)));
|
||||
event.getBlock().getWorld().dropItem(
|
||||
event.getBlock().getLocation().add(0.5, 0.2, 0.5),
|
||||
new ItemStack(_oreDrops.get(mat)));
|
||||
|
||||
}}, 1);
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -97,7 +101,8 @@ public class CutClean extends UHC
|
||||
if (item.getType() == mat)
|
||||
{
|
||||
itemIterator.remove();
|
||||
drops.add(ItemStackFactory.Instance.CreateStack(_drops.get(mat), 1 + UtilMath.r(3)));
|
||||
drops.add(ItemStackFactory.Instance.CreateStack(_drops.get(mat),
|
||||
1 + UtilMath.r(3)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,82 @@
|
||||
package nautilus.game.arcade.game.games.uhc.modes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.uhc.UHC;
|
||||
|
||||
/**
|
||||
* GodBattles
|
||||
*
|
||||
* @author xXVevzZXx
|
||||
*/
|
||||
public class GodBattles extends UHC
|
||||
{
|
||||
|
||||
private ArrayList<Material> _ores;
|
||||
private HashMap<Material, Material> _oreDrops;
|
||||
|
||||
public GodBattles(ArcadeManager manager)
|
||||
{
|
||||
super(manager);
|
||||
|
||||
_ores = new ArrayList<>();
|
||||
|
||||
_ores.add(Material.GOLD_ORE);
|
||||
_ores.add(Material.DIAMOND_ORE);
|
||||
|
||||
_oreDrops = new HashMap<>();
|
||||
_oreDrops.put(Material.GOLD_ORE, Material.GOLD_BLOCK);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void smeltOres(BlockBreakEvent event)
|
||||
{
|
||||
for (Material mat : _oreDrops.keySet())
|
||||
{
|
||||
if (event.getBlock().getType() == mat)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getBlock().setType(Material.AIR);
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
event.getBlock().getWorld().dropItem(
|
||||
event.getBlock().getLocation().add(0.5, 0.2, 0.5),
|
||||
new ItemStack(_oreDrops.get(mat)));
|
||||
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOreType(ArrayList<Block> blocks)
|
||||
{
|
||||
Material ore = _ores.get(UtilMath.r(_ores.size()));
|
||||
for (Block block : blocks)
|
||||
{
|
||||
block.setType(ore);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetMode()
|
||||
{
|
||||
return "God Battles";
|
||||
}
|
||||
|
||||
}
|
@ -340,7 +340,9 @@ public class GameCreationManager implements Listener
|
||||
value = value.split("\\(")[1];
|
||||
value = value.replace(")", "");
|
||||
|
||||
processList(clazz, game, var, value.contains(":") ? value.split("\\:") : new String[]{value}, add, remove);
|
||||
processList(clazz, game, var,
|
||||
value.contains(":") ? value.split("\\:") : new String[]
|
||||
{ value }, add, remove);
|
||||
}
|
||||
else if (value.contains("["))
|
||||
{
|
||||
@ -349,7 +351,8 @@ public class GameCreationManager implements Listener
|
||||
|
||||
Map<String, String> varMap = new HashMap<>();
|
||||
|
||||
String[] values = value.contains(":") ? value.split(":") : new String[]{value};
|
||||
String[] values = value.contains(":") ? value.split(":") : new String[]
|
||||
{ value };
|
||||
|
||||
for (String keyValueSet : values)
|
||||
{
|
||||
@ -369,7 +372,8 @@ public class GameCreationManager implements Listener
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void processMap(Class<? extends Game> clazz, Game game, String var, Map<String, String> map)
|
||||
private void processMap(Class<? extends Game> clazz, Game game, String var,
|
||||
Map<String, String> map)
|
||||
{
|
||||
Field f = getField(clazz, var);
|
||||
if (f == null)
|
||||
@ -391,7 +395,8 @@ public class GameCreationManager implements Listener
|
||||
|
||||
for (String key : map.keySet())
|
||||
{
|
||||
currentMap.put(parseValue(keyGenericClazz, key, game), parseValue(valueGenericClazz, map.get(key), game));
|
||||
currentMap.put(parseValue(keyGenericClazz, key, game),
|
||||
parseValue(valueGenericClazz, map.get(key), game));
|
||||
}
|
||||
f.setAccessible(false);
|
||||
}
|
||||
@ -402,7 +407,8 @@ public class GameCreationManager implements Listener
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void processList(Class<? extends Game> clazz, Game game, String var, String[] value, boolean add, boolean remove)
|
||||
private void processList(Class<? extends Game> clazz, Game game, String var, String[] value,
|
||||
boolean add, boolean remove)
|
||||
{
|
||||
Field f = getField(clazz, var);
|
||||
if (f == null)
|
||||
@ -532,7 +538,9 @@ public class GameCreationManager implements Listener
|
||||
{
|
||||
f = clazz.getDeclaredField("_" + var);
|
||||
}
|
||||
catch (Exception ex) {}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user