Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
06a0f3d0d5
@ -8,14 +8,16 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public enum Rank
|
||||
{
|
||||
LT("LT", ChatColor.DARK_RED),
|
||||
OWNER("Owner", ChatColor.DARK_RED),
|
||||
DEVELOPER("Dev", ChatColor.RED),
|
||||
ADMIN("Admin", ChatColor.RED),
|
||||
SNR_MODERATOR("Sr.Mod", ChatColor.GOLD),
|
||||
MODERATOR("Mod", ChatColor.GOLD),
|
||||
HELPER("Helper", ChatColor.DARK_AQUA),
|
||||
MAPDEV("Builder", ChatColor.BLUE),
|
||||
HELPER("Trainee", ChatColor.DARK_AQUA),
|
||||
MAPLEAD("MapLead", ChatColor.DARK_PURPLE),
|
||||
MAPDEV("Builder", ChatColor.BLUE),
|
||||
|
||||
|
||||
EVENT("Event", ChatColor.WHITE),
|
||||
|
||||
|
@ -12,7 +12,11 @@ public class FileUtil
|
||||
public static void DeleteFolder(File folder)
|
||||
{
|
||||
if (!folder.exists())
|
||||
{
|
||||
System.out.println("Delete target does not exist: " + folder);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
File[] files = folder.listFiles();
|
||||
|
||||
|
@ -98,8 +98,8 @@ public class UtilTime
|
||||
if (type == TimeUnit.DAYS) text = (num = UtilMath.trim(trim, time / 86400000d)) + " Day";
|
||||
else if (type == TimeUnit.HOURS) text = (num = UtilMath.trim(trim, time / 3600000d)) + " Hour";
|
||||
else if (type == TimeUnit.MINUTES) text = (num = UtilMath.trim(trim, time / 60000d)) + " Minute";
|
||||
else if (type == TimeUnit.SECONDS) text = (num = UtilMath.trim(trim, time / 1000d)) + " Second";
|
||||
else text = (num = UtilMath.trim(trim, time)) + " Millisecond";
|
||||
else if (type == TimeUnit.SECONDS) text = (int) (num = (int) UtilMath.trim(0, time / 1000d)) + " Second";
|
||||
else text = (int) (num = (int) UtilMath.trim(0, time)) + " Millisecond";
|
||||
}
|
||||
|
||||
if (num != 1)
|
||||
|
@ -16,6 +16,9 @@ import mineplex.core.account.event.ClientWebResponseEvent;
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.donation.command.CoinCommand;
|
||||
import mineplex.core.donation.command.GemCommand;
|
||||
import mineplex.core.donation.command.GoldCommand;
|
||||
import mineplex.core.donation.repository.DonationRepository;
|
||||
import mineplex.core.donation.repository.token.DonorTokenWrapper;
|
||||
import mineplex.core.server.util.TransactionResponse;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.donation;
|
||||
package mineplex.core.donation.command;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@ -11,6 +11,7 @@ import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UUIDFetcher;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
|
||||
public class CoinCommand extends CommandBase<DonationManager>
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.donation;
|
||||
package mineplex.core.donation.command;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@ -10,6 +10,7 @@ import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UUIDFetcher;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
|
||||
public class GemCommand extends CommandBase<DonationManager>
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.donation;
|
||||
package mineplex.core.donation.command;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@ -11,6 +11,7 @@ import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UUIDFetcher;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
|
||||
public class GoldCommand extends CommandBase<DonationManager>
|
||||
{
|
@ -1,9 +1,11 @@
|
||||
package mineplex.core.give;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@ -43,13 +45,16 @@ public class Give extends MiniPlugin
|
||||
help(player);
|
||||
|
||||
else if (args.length == 1)
|
||||
give(player, player.getName(), args[0], "1");
|
||||
give(player, player.getName(), args[0], "1", "");
|
||||
|
||||
else if (args.length == 2)
|
||||
give(player, args[0], args[1], "1");
|
||||
give(player, args[0], args[1], "1", "");
|
||||
|
||||
else if (args.length == 3)
|
||||
give(player, args[0], args[1], args[2], "");
|
||||
|
||||
else
|
||||
give(player, args[0], args[1], args[2]);
|
||||
give(player, args[0], args[1], args[2], args[3]);
|
||||
}
|
||||
|
||||
public void help(Player player)
|
||||
@ -57,7 +62,7 @@ public class Give extends MiniPlugin
|
||||
UtilPlayer.message(player, F.main("Give", "Commands List;"));
|
||||
}
|
||||
|
||||
public void give(Player player, String target, String itemNames, String amount)
|
||||
public void give(Player player, String target, String itemNames, String amount, String enchants)
|
||||
{
|
||||
//Item
|
||||
LinkedList<Entry<Material, Byte>> itemList = new LinkedList<Entry<Material, Byte>>();
|
||||
@ -97,7 +102,25 @@ public class Give extends MiniPlugin
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Give", "Invalid Amount [" + amount + "]. Defaulting to [1]."));
|
||||
}
|
||||
|
||||
|
||||
//Enchants
|
||||
HashMap<Enchantment, Integer> enchs = new HashMap<Enchantment, Integer>();
|
||||
if (enchants.length() > 0)
|
||||
{
|
||||
for (String cur : enchants.split(","))
|
||||
{
|
||||
try
|
||||
{
|
||||
String[] tokens = cur.split(":");
|
||||
enchs.put(Enchantment.getByName(tokens[0]), Integer.parseInt(tokens[1]));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Give", "Invalid Enchantment [" + cur + "]."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Create
|
||||
String givenList = "";
|
||||
for (Player cur : giveList)
|
||||
@ -110,7 +133,10 @@ public class Give extends MiniPlugin
|
||||
for (Player cur : giveList)
|
||||
{
|
||||
ItemStack stack = ItemStackFactory.Instance.CreateStack(curItem.getKey(), curItem.getValue(), count);
|
||||
|
||||
|
||||
//Enchants
|
||||
stack.addUnsafeEnchantments(enchs);
|
||||
|
||||
//Give
|
||||
if (UtilInv.insert(cur, stack))
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ public class GiveItemCommand extends CommandBase<InventoryManager>
|
||||
{
|
||||
public GiveItemCommand(InventoryManager plugin)
|
||||
{
|
||||
super(plugin, Rank.DEVELOPER, "giveitem");
|
||||
super(plugin, Rank.ADMIN, "giveitem");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -75,10 +75,7 @@ public class TimingManager implements Listener
|
||||
{
|
||||
if (_totalList.containsKey(title))
|
||||
{
|
||||
TimeData data = _totalList.get(title);
|
||||
data.addTime();
|
||||
|
||||
_totalList.put(title, data);
|
||||
_totalList.get(title).addTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
||||
|
||||
new Field(plugin, creature, _condition, energy, serverName);
|
||||
|
||||
DamageManager damageManager = new DamageManager(plugin, _combatManager, new NpcManager(plugin, creature), disguiseManager);
|
||||
DamageManager damageManager = new DamageManager(plugin, _combatManager, new NpcManager(plugin, creature), disguiseManager, _condition);
|
||||
|
||||
new Weapon(plugin, energy);
|
||||
new Gameplay(plugin, this, blockRestore, damageManager);
|
||||
|
@ -146,7 +146,7 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
ProjectileManager throwManager = new ProjectileManager(this);
|
||||
SkillConditionManager conditionManager = new SkillConditionManager(this);
|
||||
|
||||
DamageManager damage = new DamageManager(this, combatManager, npcManager, disguiseManager);
|
||||
DamageManager damage = new DamageManager(this, combatManager, npcManager, disguiseManager, conditionManager);
|
||||
Fire fire = new Fire(this, conditionManager, damage);
|
||||
Teleport teleport = new Teleport(this);
|
||||
Energy energy = new Energy(this);
|
||||
|
@ -67,7 +67,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
ChatColor.RESET + "",
|
||||
ChatColor.RESET + "Search for chests to find loot and ",
|
||||
ChatColor.RESET + "fight others to be the last man standing. ",
|
||||
ChatColor.RESET + "Beware of the deep freeze!",
|
||||
ChatColor.RESET + "Stay away from the borders!",
|
||||
ChatColor.RESET + "",
|
||||
ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("HG") + ChatColor.RESET + " other players!",
|
||||
}));
|
||||
|
@ -3,6 +3,7 @@ package mineplex.minecraft.game.core.damage;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.F;
|
||||
@ -16,6 +17,7 @@ import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.npc.NpcManager;
|
||||
import mineplex.minecraft.game.core.combat.CombatManager;
|
||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||
import mineplex.minecraft.game.core.damage.compatibility.NpcProtectListener;
|
||||
import net.minecraft.server.v1_7_R4.DamageSource;
|
||||
import net.minecraft.server.v1_7_R4.EntityHuman;
|
||||
@ -28,6 +30,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Fish;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -42,24 +45,28 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.sun.jndi.ldap.ManageReferralControl;
|
||||
|
||||
public class DamageManager extends MiniPlugin
|
||||
{
|
||||
private CombatManager _combatManager;
|
||||
private DisguiseManager _disguiseManager;
|
||||
private ConditionManager _conditionManager;
|
||||
protected Field _lastDamageByPlayerTime;
|
||||
protected Method _k;
|
||||
|
||||
public boolean UseSimpleWeaponDamage = false;
|
||||
public boolean DisableDamageChanges = false;
|
||||
|
||||
|
||||
private boolean _enabled = true;
|
||||
|
||||
public DamageManager(JavaPlugin plugin, CombatManager combatManager, NpcManager npcManager, DisguiseManager disguiseManager)
|
||||
|
||||
public DamageManager(JavaPlugin plugin, CombatManager combatManager, NpcManager npcManager, DisguiseManager disguiseManager, ConditionManager conditionManager)
|
||||
{
|
||||
super("Damage Manager", plugin);
|
||||
|
||||
_combatManager = combatManager;
|
||||
_disguiseManager = disguiseManager;
|
||||
_conditionManager = conditionManager;
|
||||
|
||||
try
|
||||
{
|
||||
@ -100,9 +107,9 @@ public class DamageManager extends MiniPlugin
|
||||
//Pre-Event Modifications
|
||||
if (!DisableDamageChanges)
|
||||
WeaponDamage(event, damager);
|
||||
|
||||
|
||||
double damage = event.getDamage();
|
||||
|
||||
|
||||
//Consistent Arrow Damage
|
||||
if (projectile != null && projectile instanceof Arrow)
|
||||
{
|
||||
@ -113,7 +120,7 @@ public class DamageManager extends MiniPlugin
|
||||
NewDamageEvent(damagee, damager, projectile, event.getCause(), damage, true, false, false, null, null, preCancel);
|
||||
|
||||
//System.out.println(UtilEnt.getName(damagee) + " by " + event.getCause() + " at " + UtilWorld.locToStr(damagee.getLocation()));
|
||||
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@ -123,7 +130,7 @@ public class DamageManager extends MiniPlugin
|
||||
if (event.isCancelled())
|
||||
{
|
||||
Projectile projectile = GetProjectile(event);
|
||||
|
||||
|
||||
if (projectile instanceof Arrow)
|
||||
{
|
||||
projectile.teleport(new Location(projectile.getWorld(), 0, 0, 0));
|
||||
@ -191,7 +198,7 @@ public class DamageManager extends MiniPlugin
|
||||
event.SetCancelled("Damagee in Creative");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (UtilPlayer.isSpectator(damagee))
|
||||
{
|
||||
event.SetCancelled("Damagee in Spectator");
|
||||
@ -230,13 +237,80 @@ public class DamageManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void handleEnchants(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
//Defensive
|
||||
Player damagee = event.GetDamageePlayer();
|
||||
if (damagee != null)
|
||||
{
|
||||
for (ItemStack stack : damagee.getInventory().getArmorContents())
|
||||
{
|
||||
if (stack == null)
|
||||
continue;
|
||||
|
||||
Map<Enchantment, Integer> enchants = stack.getEnchantments();
|
||||
for (Enchantment e : enchants.keySet())
|
||||
{
|
||||
if (e.equals(Enchantment.PROTECTION_ENVIRONMENTAL))
|
||||
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
||||
|
||||
else if (e.equals(Enchantment.PROTECTION_FIRE) &&
|
||||
event.GetCause() == DamageCause.FIRE &&
|
||||
event.GetCause() == DamageCause.FIRE_TICK &&
|
||||
event.GetCause() == DamageCause.LAVA)
|
||||
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
||||
|
||||
else if (e.equals(Enchantment.PROTECTION_FALL) &&
|
||||
event.GetCause() == DamageCause.FALL)
|
||||
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
||||
|
||||
else if (e.equals(Enchantment.PROTECTION_EXPLOSIONS) &&
|
||||
event.GetCause() == DamageCause.ENTITY_EXPLOSION)
|
||||
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
||||
|
||||
else if (e.equals(Enchantment.PROTECTION_PROJECTILE) &&
|
||||
event.GetCause() == DamageCause.PROJECTILE)
|
||||
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Offensive
|
||||
Player damager = event.GetDamagerPlayer(true);
|
||||
if (damager != null)
|
||||
{
|
||||
ItemStack stack = damager.getItemInHand();
|
||||
if (stack == null)
|
||||
return;
|
||||
|
||||
Map<Enchantment, Integer> enchants = stack.getEnchantments();
|
||||
for (Enchantment e : enchants.keySet())
|
||||
{
|
||||
if (e.equals(Enchantment.ARROW_KNOCKBACK) || e.equals(Enchantment.KNOCKBACK))
|
||||
event.AddKnockback("Ench Knockback", 1 + (0.5 * (double)enchants.get(e)));
|
||||
|
||||
else if (e.equals(Enchantment.ARROW_DAMAGE))
|
||||
event.AddMod("Enchant", "Ench Damage", 0.5 * (double)enchants.get(e), true);
|
||||
|
||||
else if (e.equals(Enchantment.ARROW_FIRE) || e.equals(Enchantment.FIRE_ASPECT))
|
||||
if (_conditionManager != null)
|
||||
_conditionManager.Factory().Ignite("Ench Fire", event.GetDamageeEntity(), damager,
|
||||
1 * (double)enchants.get(e), false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void EndDamageEvent(CustomDamageEvent event)
|
||||
{
|
||||
if (!event.IsCancelled() && event.GetDamage() > 0)
|
||||
{
|
||||
Damage(event);
|
||||
|
||||
|
||||
//DING ARROW
|
||||
if (event.GetProjectile() != null && event.GetProjectile() instanceof Arrow)
|
||||
{
|
||||
@ -247,7 +321,7 @@ public class DamageManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DisplayDamage(event);
|
||||
}
|
||||
|
||||
@ -255,10 +329,10 @@ public class DamageManager extends MiniPlugin
|
||||
{
|
||||
if (event.GetDamageeEntity() == null)
|
||||
return;
|
||||
|
||||
|
||||
if (event.GetDamageeEntity().getHealth() <= 0)
|
||||
return;
|
||||
|
||||
|
||||
//Player Conditions
|
||||
if (event.GetDamageePlayer() != null)
|
||||
{
|
||||
@ -293,29 +367,34 @@ public class DamageManager extends MiniPlugin
|
||||
//Sticky Arrow
|
||||
if (event.GetCause() == DamageCause.PROJECTILE)
|
||||
((CraftLivingEntity)event.GetDamageeEntity()).getHandle().p(((CraftLivingEntity)event.GetDamageeEntity()).getHandle().aZ() + 1);
|
||||
|
||||
|
||||
//Knockback
|
||||
double knockback = event.GetDamage();
|
||||
if (knockback < 2) knockback = 2;
|
||||
knockback = Math.log10(knockback);
|
||||
|
||||
for (double cur : event.GetKnockback().values())
|
||||
knockback = knockback * cur;
|
||||
if (event.IsKnockback() && event.GetDamagerEntity(true) != null)
|
||||
{
|
||||
//Base
|
||||
double knockback = event.GetDamage();
|
||||
if (knockback < 2) knockback = 2;
|
||||
knockback = Math.log10(knockback);
|
||||
|
||||
if (event.IsKnockback())
|
||||
if (event.GetDamagerEntity(true) != null)
|
||||
{
|
||||
Location origin = event.GetDamagerEntity(true).getLocation();
|
||||
if (event.getKnockbackOrigin() != null)
|
||||
origin = event.getKnockbackOrigin();
|
||||
|
||||
Vector trajectory = UtilAlg.getTrajectory2d(origin, event.GetDamageeEntity().getLocation());
|
||||
trajectory.multiply(0.6 * knockback);
|
||||
trajectory.setY(Math.abs(trajectory.getY()));
|
||||
//Mults
|
||||
for (double cur : event.GetKnockback().values())
|
||||
knockback = knockback * cur;
|
||||
|
||||
//Origin
|
||||
Location origin = event.GetDamagerEntity(true).getLocation();
|
||||
if (event.getKnockbackOrigin() != null)
|
||||
origin = event.getKnockbackOrigin();
|
||||
|
||||
//Vec
|
||||
Vector trajectory = UtilAlg.getTrajectory2d(origin, event.GetDamageeEntity().getLocation());
|
||||
trajectory.multiply(0.6 * knockback);
|
||||
trajectory.setY(Math.abs(trajectory.getY()));
|
||||
|
||||
//Apply
|
||||
UtilAction.velocity(event.GetDamageeEntity(),
|
||||
trajectory, 0.2 + trajectory.length() * 0.8, false, 0, Math.abs(0.2 * knockback), 0.4 + (0.04 * knockback), true);
|
||||
}
|
||||
|
||||
UtilAction.velocity(event.GetDamageeEntity(),
|
||||
trajectory, 0.2 + trajectory.length() * 0.8, false, 0, Math.abs(0.2 * knockback), 0.4 + (0.04 * knockback), true);
|
||||
}
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
@ -365,7 +444,7 @@ public class DamageManager extends MiniPlugin
|
||||
{
|
||||
EntityLiving entityDamagee = ((CraftLivingEntity)damagee).getHandle();
|
||||
EntityLiving entityDamager = null;
|
||||
|
||||
|
||||
if (damager != null)
|
||||
entityDamager= ((CraftLivingEntity)damager).getHandle();
|
||||
|
||||
@ -426,7 +505,7 @@ public class DamageManager extends MiniPlugin
|
||||
LivingEntity damagee = event.GetDamageeEntity();
|
||||
if (damagee == null) return;
|
||||
|
||||
|
||||
|
||||
if (_disguiseManager.isDisguised(damagee))
|
||||
{
|
||||
_disguiseManager.getDisguise(damagee).playHurtSound();
|
||||
@ -576,7 +655,7 @@ public class DamageManager extends MiniPlugin
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void SetEnabled(boolean var)
|
||||
{
|
||||
_enabled = var;
|
||||
@ -586,4 +665,9 @@ public class DamageManager extends MiniPlugin
|
||||
{
|
||||
return _combatManager;
|
||||
}
|
||||
|
||||
public void setConditionManager(ConditionManager cm)
|
||||
{
|
||||
_conditionManager = cm;
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class Arcade extends JavaPlugin
|
||||
|
||||
DisguiseManager disguiseManager = new DisguiseManager(this, packetHandler);
|
||||
|
||||
_damageManager = new DamageManager(this, new CombatManager(this), new NpcManager(this, creature), disguiseManager);
|
||||
_damageManager = new DamageManager(this, new CombatManager(this), new NpcManager(this, creature), disguiseManager, null);
|
||||
|
||||
Punish punish = new Punish(this, webServerAddress, _clientManager);
|
||||
AntiHack.Initialize(this, punish, portal, preferenceManager, _clientManager);
|
||||
|
@ -214,7 +214,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
// Modules
|
||||
_blockRestore = new BlockRestore(plugin);
|
||||
|
||||
|
||||
_blood = blood;
|
||||
_preferencesManager = preferences;
|
||||
|
||||
@ -222,8 +221,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
_explosionManager.SetDebris(false);
|
||||
|
||||
if (serverConfig.GameList.contains(GameType.ChampionsDominate)
|
||||
|| serverConfig.GameList.contains(GameType.ChampionsTDM)
|
||||
|| serverConfig.GameList.contains(GameType.ChampionsMOBA))
|
||||
|| serverConfig.GameList.contains(GameType.ChampionsTDM)
|
||||
|| serverConfig.GameList.contains(GameType.ChampionsMOBA))
|
||||
{
|
||||
_conditionManager = new SkillConditionManager(plugin);
|
||||
}
|
||||
@ -231,7 +230,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
{
|
||||
_conditionManager = new ConditionManager(plugin);
|
||||
}
|
||||
|
||||
|
||||
_clientManager = clientManager;
|
||||
_serverStatusManager = serverStatusManager;
|
||||
_chat = chat;
|
||||
@ -239,7 +238,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
|
||||
_damageManager = damageManager;
|
||||
_damageManager.UseSimpleWeaponDamage = true;
|
||||
|
||||
_damageManager.setConditionManager(_conditionManager);
|
||||
|
||||
_disguiseManager = disguiseManager;
|
||||
|
||||
_donationManager = donationManager;
|
||||
|
@ -10,7 +10,7 @@ public class YoutubeCommand extends CommandBase<ArcadeManager>
|
||||
{
|
||||
public YoutubeCommand(ArcadeManager plugin)
|
||||
{
|
||||
super(plugin, Rank.OWNER, new Rank[] {Rank.YOUTUBE}, "youtube");
|
||||
super(plugin, Rank.OWNER, new Rank[] {Rank.YOUTUBE, Rank.TWITCH}, new String[] {"youtube", "twitch"});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -78,7 +78,7 @@ import nautilus.game.arcade.managers.GameHostManager;
|
||||
|
||||
public class EventGame extends SoloGame
|
||||
{
|
||||
private GameHostManager _mps;
|
||||
private GameHostManager _mps;
|
||||
|
||||
private String[] _sideText = new String[] {
|
||||
" "," "," "," "," "," "," "," "," "," "," "," "
|
||||
@ -89,7 +89,7 @@ public class EventGame extends SoloGame
|
||||
private NautHashMap<String, Integer> _forcefield = new NautHashMap<String, Integer>();
|
||||
|
||||
private ItemStack[] _kitItems = new ItemStack[6];
|
||||
|
||||
|
||||
private boolean _allowAllGadgets = false;
|
||||
private HashSet<SalesPackageBase> _gadgetWhitelist = new HashSet<SalesPackageBase>();
|
||||
|
||||
@ -176,38 +176,40 @@ public class EventGame extends SoloGame
|
||||
private void commandHelp(Player player)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Event", "Displaying Commands;"));
|
||||
|
||||
|
||||
UtilPlayer.message(player, F.value("/e settings", "View Settings Help"));
|
||||
|
||||
|
||||
UtilPlayer.message(player, F.value("/e tp <Player>", "Teleport to Target"));
|
||||
UtilPlayer.message(player, F.value("/e tp here <Player>", "Teleport Target to Self"));
|
||||
UtilPlayer.message(player, F.value("/e tp here all", "Teleport Everyone to Self"));
|
||||
|
||||
|
||||
UtilPlayer.message(player, F.value("/e gadget", "Toggle Gadgets"));
|
||||
UtilPlayer.message(player, F.value("/e gadget list", "Lists Gadgets (Shows Whitelist)"));
|
||||
UtilPlayer.message(player, F.value("/e gadget <Gadget>", "Toggles Whitelist for Gadget"));
|
||||
UtilPlayer.message(player, F.value("/e gadget clear", "Clears Gadget Whitelist"));
|
||||
|
||||
|
||||
UtilPlayer.message(player, F.value("/e silence [Time]", "Silence Chat"));
|
||||
|
||||
|
||||
UtilPlayer.message(player, F.value("/e admin [Player]", "Toggle Event Admin"));
|
||||
|
||||
UtilPlayer.message(player, F.value("/e gm [Player]", "Toggle Creative Mode"));
|
||||
|
||||
|
||||
UtilPlayer.message(player, F.value("/e radius [Radius]", "Set Forcefield Radius"));
|
||||
|
||||
UtilPlayer.message(player, F.value("/e give <item> <amount>", "Give Item to Self"));
|
||||
UtilPlayer.message(player, F.value("/e give <player> <item> <amount>", "Give Item to Player"));
|
||||
UtilPlayer.message(player, F.value("/e give <item> <amount>", "Give Item"));
|
||||
UtilPlayer.message(player, F.value("/e give <player> <item> <amount> [e:#,e:#...]", "Give Item"));
|
||||
|
||||
UtilPlayer.message(player, F.value("/e doublejump", "Toggles Double Jump"));
|
||||
|
||||
|
||||
UtilPlayer.message(player, F.value("/e scoreboard <Line #> [Text]", "Sets Scoreboard Text"));
|
||||
|
||||
|
||||
UtilPlayer.message(player, F.value("/e mob <type> [#Amount] n[Name] s[Size] [angry] [baby]", ""));
|
||||
UtilPlayer.message(player, F.value("/e mob kill <type>", "Kill Mobs"));
|
||||
|
||||
|
||||
UtilPlayer.message(player, F.value("/e kit set", "Sets Player Kit to your Hotbar"));
|
||||
UtilPlayer.message(player, F.value("/e kit apply", "Gives Kit to Players"));
|
||||
UtilPlayer.message(player, F.value("/e kit clear", "Gives Kit to Players"));
|
||||
|
||||
|
||||
UtilPlayer.message(player, F.value("/e effect <player> <type> <mult> <seconds>", ""));
|
||||
UtilPlayer.message(player, F.value("/e effect <player> clear", ""));
|
||||
}
|
||||
@ -276,6 +278,10 @@ public class EventGame extends SoloGame
|
||||
{
|
||||
commandSilence(event.getPlayer(), args);
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("admin"))
|
||||
{
|
||||
commandAdmin(event.getPlayer(), args);
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("gm"))
|
||||
{
|
||||
commandGamemode(event.getPlayer(), args);
|
||||
@ -590,7 +596,7 @@ public class EventGame extends SoloGame
|
||||
|
||||
commandHelpSettings(player);
|
||||
}
|
||||
|
||||
|
||||
private void commandTime(Player player, String[] args)
|
||||
{
|
||||
try
|
||||
@ -680,32 +686,32 @@ public class EventGame extends SoloGame
|
||||
Announce(F.main("Inventory", F.value("Allow All Gadgets", F.ed(_allowAllGadgets))));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (args.length >= 2 && args[1].equalsIgnoreCase("clear"))
|
||||
{
|
||||
_gadgetWhitelist.clear();
|
||||
Announce(F.main("Inventory", F.value("Gadget Whitelist", "Cleared.")));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (args.length >= 2 && args[1].equalsIgnoreCase("list"))
|
||||
{
|
||||
ChatColor color = ChatColor.AQUA;
|
||||
|
||||
|
||||
//Gadgets
|
||||
for (GadgetType type : GadgetType.values())
|
||||
{
|
||||
String items = C.Bold + type + " Gadgets> ";
|
||||
|
||||
|
||||
for (Gadget gadget : Manager.getCosmeticManager().getGadgetManager().getGadgets(type))
|
||||
{
|
||||
items += color + gadget.GetName().replaceAll(" ", "") + " ";
|
||||
color = (color == ChatColor.AQUA ? ChatColor.DARK_AQUA : ChatColor.AQUA);
|
||||
}
|
||||
|
||||
|
||||
UtilPlayer.message(player, items);
|
||||
}
|
||||
|
||||
|
||||
//Mounts
|
||||
String mounts = C.Bold + "Mount Gadgets> ";
|
||||
for (Mount<?> mount : Manager.getCosmeticManager().getMountManager().getMounts())
|
||||
@ -714,10 +720,10 @@ public class EventGame extends SoloGame
|
||||
color = (color == ChatColor.AQUA ? ChatColor.DARK_AQUA : ChatColor.AQUA);
|
||||
}
|
||||
UtilPlayer.message(player, mounts);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (args.length >= 2)
|
||||
{
|
||||
//Gadgets
|
||||
@ -737,12 +743,12 @@ public class EventGame extends SoloGame
|
||||
Announce(F.main("Inventory", F.value(gadget.GetName() + " Gadget", F.ed(true))));
|
||||
_gadgetWhitelist.add(gadget);
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Mounts
|
||||
for (Mount mount : Manager.getCosmeticManager().getMountManager().getMounts())
|
||||
{
|
||||
@ -758,16 +764,16 @@ public class EventGame extends SoloGame
|
||||
Announce(F.main("Inventory", F.value(mount.GetName() + " Gadget", F.ed(true))));
|
||||
_gadgetWhitelist.add(mount);
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
UtilPlayer.message(player, F.main("Inventory", args[1] + " is not a valid gadget."));
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
commandHelp(player);
|
||||
}
|
||||
|
||||
@ -804,6 +810,28 @@ public class EventGame extends SoloGame
|
||||
}
|
||||
}
|
||||
|
||||
//Gamemode (Self and Others)
|
||||
private void commandAdmin(Player player, String[] args)
|
||||
{
|
||||
Player target = player;
|
||||
|
||||
if (args.length >= 2)
|
||||
{
|
||||
Player newTarget = UtilPlayer.searchOnline(player, args[1], true);
|
||||
if (newTarget != null)
|
||||
target = newTarget;
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
if (Manager.GetGameHostManager().isAdmin(target, false))
|
||||
Manager.GetGameHostManager().giveAdmin(target);
|
||||
else
|
||||
Manager.GetGameHostManager().removeAdmin(target.getName());
|
||||
|
||||
UtilPlayer.message(player, F.main("Event Admin", target.getName() + " Admin: " + F.tf(Manager.GetGameHostManager().isAdmin(target, false))));
|
||||
}
|
||||
|
||||
//Gamemode (Self and Others)
|
||||
private void commandGamemode(Player player, String[] args)
|
||||
{
|
||||
@ -856,13 +884,13 @@ public class EventGame extends SoloGame
|
||||
private void commandGive(Player player, String[] args)
|
||||
{
|
||||
String[] newArgs = new String[args.length-1];
|
||||
|
||||
|
||||
for (int i=0 ; i<newArgs.length ; i++)
|
||||
newArgs[i] = args[i+1];
|
||||
|
||||
Give.Instance.parseInput(player, newArgs);
|
||||
}
|
||||
|
||||
Give.Instance.parseInput(player, newArgs);
|
||||
}
|
||||
|
||||
//Double Jump
|
||||
private void commandDoubleJump(Player player, String[] args)
|
||||
{
|
||||
@ -1245,44 +1273,44 @@ public class EventGame extends SoloGame
|
||||
|
||||
UtilPlayer.message(caller, F.main("Creature", "Killed " + target + ". " + count + " Removed."));
|
||||
}
|
||||
|
||||
|
||||
private void commandKit(Player caller, String[] args)
|
||||
{
|
||||
if (args.length >= 2 && args[1].equalsIgnoreCase("apply"))
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
giveItems(player);
|
||||
|
||||
|
||||
Announce(F.main("Event Settings", F.value("Player Kit", "Applied to Players")));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (args.length >= 2 && args[1].equalsIgnoreCase("clear"))
|
||||
{
|
||||
_kitItems = new ItemStack[6];
|
||||
Announce(F.main("Event Settings", F.value("Player Kit", "Cleared Kit")));
|
||||
_kitItems = new ItemStack[6];
|
||||
Announce(F.main("Event Settings", F.value("Player Kit", "Cleared Kit")));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (args.length >= 2 && args[1].equalsIgnoreCase("set"))
|
||||
{
|
||||
_kitItems = new ItemStack[6];
|
||||
|
||||
for (int i=0 ; i<6 ; i++)
|
||||
{
|
||||
if (caller.getInventory().getItem(i) != null)
|
||||
_kitItems[i] = caller.getInventory().getItem(i).clone();
|
||||
else
|
||||
_kitItems[i] = null;
|
||||
}
|
||||
|
||||
Announce(F.main("Event Settings", F.value("Player Kit", "Updated Items")));
|
||||
return;
|
||||
_kitItems = new ItemStack[6];
|
||||
|
||||
for (int i=0 ; i<6 ; i++)
|
||||
{
|
||||
if (caller.getInventory().getItem(i) != null)
|
||||
_kitItems[i] = caller.getInventory().getItem(i).clone();
|
||||
else
|
||||
_kitItems[i] = null;
|
||||
}
|
||||
|
||||
Announce(F.main("Event Settings", F.value("Player Kit", "Updated Items")));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
commandHelp(caller);
|
||||
}
|
||||
|
||||
|
||||
private void commandEffect(Player caller, String[] args)
|
||||
{
|
||||
//Clear
|
||||
@ -1302,12 +1330,12 @@ public class EventGame extends SoloGame
|
||||
if (targets.isEmpty())
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (Player player : targets)
|
||||
{
|
||||
//Remove all conditions
|
||||
Manager.GetCondition().EndCondition(player, null, null);
|
||||
|
||||
|
||||
//Remove all effects
|
||||
player.removePotionEffect(PotionEffectType.ABSORPTION);
|
||||
player.removePotionEffect(PotionEffectType.BLINDNESS);
|
||||
@ -1333,10 +1361,10 @@ public class EventGame extends SoloGame
|
||||
player.removePotionEffect(PotionEffectType.WEAKNESS);
|
||||
player.removePotionEffect(PotionEffectType.WITHER);
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//Apply
|
||||
if (args.length >= 5)
|
||||
{
|
||||
@ -1354,7 +1382,7 @@ public class EventGame extends SoloGame
|
||||
if (targets.isEmpty())
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//Get Type
|
||||
PotionEffectType type = PotionEffectType.getByName(args[2]);
|
||||
if (type == null)
|
||||
@ -1363,7 +1391,7 @@ public class EventGame extends SoloGame
|
||||
UtilPlayer.message(caller, F.value("Valid Types", "http://minecraft.gamepedia.com/Status_effect"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//Get Multiplier
|
||||
int mult = 0;
|
||||
try
|
||||
@ -1380,7 +1408,7 @@ public class EventGame extends SoloGame
|
||||
UtilPlayer.message(caller, F.main("Effect", "Invalid Effect Level: " + args[3]));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//Get Duration
|
||||
int dur = 0;
|
||||
try
|
||||
@ -1395,25 +1423,25 @@ public class EventGame extends SoloGame
|
||||
UtilPlayer.message(caller, F.main("Effect", "Invalid Effect Duration: " + args[4]));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//Apply
|
||||
PotionEffect effect = new PotionEffect(type, dur*20, mult);
|
||||
for (Player cur : targets)
|
||||
{
|
||||
cur.addPotionEffect(effect);
|
||||
}
|
||||
|
||||
|
||||
if (args[1].equalsIgnoreCase("all"))
|
||||
Announce(F.main("Effect", F.value("Applied Effect", type.getName() + " " + (mult+1) + " for " + dur + "s")));
|
||||
else
|
||||
UtilPlayer.message(caller, F.main("Effect", "Applied " + type.getName() + " " + (mult+1) + " for " + dur + "s for Targets."));
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
commandHelp(caller);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void doubleJumpTrigger(PlayerToggleFlightEvent event)
|
||||
{
|
||||
@ -1500,7 +1528,7 @@ public class EventGame extends SoloGame
|
||||
|
||||
if (_mps.isAdmin(other, false))
|
||||
continue;
|
||||
|
||||
|
||||
int range = _forcefield.get(player.getName());
|
||||
|
||||
if (UtilMath.offset(other, player) > range)
|
||||
@ -1613,10 +1641,10 @@ public class EventGame extends SoloGame
|
||||
{
|
||||
if (_kitItems[i] == null)
|
||||
continue;
|
||||
|
||||
|
||||
player.getInventory().addItem(_kitItems[i].clone());
|
||||
}
|
||||
|
||||
|
||||
UtilInv.Update(player);
|
||||
}
|
||||
|
||||
@ -1626,13 +1654,13 @@ public class EventGame extends SoloGame
|
||||
if (event.getSpawnReason() != SpawnReason.CUSTOM)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void gadgetDisable(GadgetActivateEvent event)
|
||||
{
|
||||
if (_allowAllGadgets)
|
||||
return;
|
||||
|
||||
|
||||
if (!_gadgetWhitelist.contains(event.getGadget()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
@ -1640,13 +1668,13 @@ public class EventGame extends SoloGame
|
||||
//event.getPlayer().closeInventory();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void mountDisable(MountActivateEvent event)
|
||||
{
|
||||
if (_allowAllGadgets)
|
||||
return;
|
||||
|
||||
|
||||
if (!_gadgetWhitelist.contains(event.getMount()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
@ -1654,7 +1682,7 @@ public class EventGame extends SoloGame
|
||||
//event.getPlayer().closeInventory();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void entityDeathEvent(EntityDeathEvent event)
|
||||
{
|
||||
|
@ -15,11 +15,13 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.BlockDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
@ -46,6 +48,8 @@ public class SnowFight extends TeamGame
|
||||
{
|
||||
"Just like... kill your enemies. with snow."
|
||||
});
|
||||
|
||||
this.HungerSet = 20;
|
||||
}
|
||||
|
||||
|
||||
@ -80,11 +84,12 @@ public class SnowFight extends TeamGame
|
||||
if (!IsSnow(event.getBlock()))
|
||||
return;
|
||||
|
||||
if (player.getInventory().getHeldItemSlot() != 0)
|
||||
|
||||
if (UtilInv.contains(player, Material.SNOW_BALL, (byte)0, 16))
|
||||
return;
|
||||
|
||||
//Item
|
||||
SnowballCount(player, 1);
|
||||
UtilInv.insert(player, new ItemStack(Material.SNOW_BALL));
|
||||
|
||||
//Snow Height
|
||||
SnowDecrease(event.getBlock(), 1);
|
||||
@ -93,83 +98,83 @@ public class SnowFight extends TeamGame
|
||||
event.getBlock().getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, 80);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void InteractSnowball(PlayerInteractEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
// @EventHandler
|
||||
// public void InteractSnowball(PlayerInteractEvent event)
|
||||
// {
|
||||
// Player player = event.getPlayer();
|
||||
//
|
||||
// if (!IsLive())
|
||||
// return;
|
||||
//
|
||||
// if (!IsPlaying(player))
|
||||
// return;
|
||||
//
|
||||
// if (!UtilGear.isMat(player.getItemInHand(), Material.SNOW_BALL))
|
||||
// return;
|
||||
//
|
||||
// event.setCancelled(true);
|
||||
//
|
||||
// if (UtilEvent.isAction(event, ActionType.L))
|
||||
// SnowballThrow(player);
|
||||
//
|
||||
// else if (UtilEvent.isAction(event, ActionType.R_BLOCK))
|
||||
// SnowballPlace(player, event.getClickedBlock(), 1);
|
||||
// }
|
||||
//
|
||||
// private void SnowballPlace(Player player, Block block, int above)
|
||||
// {
|
||||
// if (block.getTypeId() == 78 || UtilBlock.airFoliage(block))
|
||||
// {
|
||||
// //Build
|
||||
// if (block.getTypeId() == 78)
|
||||
// {
|
||||
// block.setTypeIdAndData(78, (byte)(block.getData() + 1), true);
|
||||
//
|
||||
// if (block.getData() >= 7)
|
||||
// block.setTypeIdAndData(80, (byte)0, true);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// block.setTypeIdAndData(78, (byte)0, true);
|
||||
// }
|
||||
//
|
||||
// //Sound
|
||||
// block.getWorld().playSound(block.getLocation(), Sound.STEP_SNOW, 1f, 0.6f);
|
||||
//
|
||||
// //Use Snow
|
||||
// SnowballCount(player, -1);
|
||||
// }
|
||||
// else if ((IsSnow(block) || UtilBlock.solid(block)) && above > 0)
|
||||
// {
|
||||
// SnowballPlace(player, block.getRelative(BlockFace.UP), above - 1);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void SnowballThrow(Player player)
|
||||
// {
|
||||
// //Throw
|
||||
// player.launchProjectile(Snowball.class);
|
||||
//
|
||||
// //Use Snow
|
||||
// SnowballCount(player, -1);
|
||||
//
|
||||
// //Sound
|
||||
// player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 3f, 1.5f);
|
||||
// }
|
||||
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (!IsPlaying(player))
|
||||
return;
|
||||
|
||||
if (!UtilGear.isMat(player.getItemInHand(), Material.SNOW_BALL))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
if (UtilEvent.isAction(event, ActionType.L))
|
||||
SnowballThrow(player);
|
||||
|
||||
else if (UtilEvent.isAction(event, ActionType.R_BLOCK))
|
||||
SnowballPlace(player, event.getClickedBlock(), 1);
|
||||
}
|
||||
|
||||
private void SnowballPlace(Player player, Block block, int above)
|
||||
{
|
||||
if (block.getTypeId() == 78 || UtilBlock.airFoliage(block))
|
||||
{
|
||||
//Build
|
||||
if (block.getTypeId() == 78)
|
||||
{
|
||||
block.setTypeIdAndData(78, (byte)(block.getData() + 1), true);
|
||||
|
||||
if (block.getData() >= 7)
|
||||
block.setTypeIdAndData(80, (byte)0, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
block.setTypeIdAndData(78, (byte)0, true);
|
||||
}
|
||||
|
||||
//Sound
|
||||
block.getWorld().playSound(block.getLocation(), Sound.STEP_SNOW, 1f, 0.6f);
|
||||
|
||||
//Use Snow
|
||||
SnowballCount(player, -1);
|
||||
}
|
||||
else if ((IsSnow(block) || UtilBlock.solid(block)) && above > 0)
|
||||
{
|
||||
SnowballPlace(player, block.getRelative(BlockFace.UP), above - 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void SnowballThrow(Player player)
|
||||
{
|
||||
//Throw
|
||||
player.launchProjectile(Snowball.class);
|
||||
|
||||
//Use Snow
|
||||
SnowballCount(player, -1);
|
||||
|
||||
//Sound
|
||||
player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 3f, 1.5f);
|
||||
}
|
||||
|
||||
private void SnowballCount(Player player, int count)
|
||||
{
|
||||
if (player.getInventory().getItem(1) != null)
|
||||
count += player.getInventory().getItem(1).getAmount();
|
||||
|
||||
if (count > 16)
|
||||
count = 16;
|
||||
|
||||
if (count > 0)
|
||||
player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.SNOW_BALL, count));
|
||||
else
|
||||
player.getInventory().setItem(1, null);
|
||||
}
|
||||
// private void SnowballCount(Player player, int count)
|
||||
// {
|
||||
// if (player.getInventory().getItem(1) != null)
|
||||
// count += player.getInventory().getItem(1).getAmount();
|
||||
//
|
||||
// if (count > 16)
|
||||
// count = 16;
|
||||
//
|
||||
// if (count > 0)
|
||||
// player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.SNOW_BALL, count));
|
||||
// else
|
||||
// player.getInventory().setItem(1, null);
|
||||
// }
|
||||
|
||||
private void SnowDecrease(Block block, int height)
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -323,7 +323,7 @@ public enum SpellType // ❤
|
||||
"Rumble", // Spell name
|
||||
new ItemStack(Material.PUMPKIN_SEEDS), // Spell icon
|
||||
SpellRumble.class, // Spell class
|
||||
5, // Spell max level
|
||||
3, // Spell max level
|
||||
30, // Mana cost
|
||||
15, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
|
@ -509,7 +509,7 @@ public class GameHostManager implements Listener
|
||||
|
||||
public int getMaxPlayerCap()
|
||||
{
|
||||
if (hasRank(Rank.SNR_MODERATOR) || _hostRank == Rank.YOUTUBE)
|
||||
if (hasRank(Rank.SNR_MODERATOR) || _hostRank == Rank.YOUTUBE || _hostRank == Rank.TWITCH)
|
||||
return 100;
|
||||
else if (hasRank(Rank.LEGEND))
|
||||
return 40;
|
||||
|
@ -224,11 +224,8 @@ public class GameManager implements Listener
|
||||
|
||||
public void StateCountdown(Game game, int timer, boolean force)
|
||||
{
|
||||
if (game instanceof UHC)
|
||||
{
|
||||
if (((UHC)game).isMapLoaded())
|
||||
return;
|
||||
}
|
||||
if (game instanceof UHC && !((UHC)game).isMapLoaded())
|
||||
return;
|
||||
|
||||
//Disabling Cosmetics
|
||||
if (game.GetCountdown() <= 5 && game.GetCountdown() >= 0 && game.GadgetsDisabled)
|
||||
|
@ -44,7 +44,7 @@ public class ExperienceStatTracker extends StatTracker<Game>
|
||||
for (Player player : event.GetGame().GetPlayers(false))
|
||||
{
|
||||
//Tally Gems
|
||||
double gems = 0;
|
||||
double gemExp = 0;
|
||||
for (String reason : event.GetGame().GetGems(player).keySet())
|
||||
{
|
||||
if (reason.toLowerCase().contains("participation"))
|
||||
@ -52,21 +52,20 @@ public class ExperienceStatTracker extends StatTracker<Game>
|
||||
|
||||
GemData gem = event.GetGame().GetGems(player).get(reason);
|
||||
|
||||
gems += (int)gem.Gems;
|
||||
gemExp += (int)gem.Gems;
|
||||
}
|
||||
|
||||
gems = Math.min(gems, 250);
|
||||
gemExp = Math.min(gemExp, 250) * 3;
|
||||
|
||||
//Game Time
|
||||
double time = (System.currentTimeMillis() - _startTime)/60000d;
|
||||
//Game Time = 1 Exp per 3 Seconds
|
||||
double timeExp = (System.currentTimeMillis() - _startTime)/2000d;
|
||||
|
||||
//Mult
|
||||
double mult = 1;
|
||||
if (!winners.contains(player))
|
||||
mult = 0.25;
|
||||
if (winners.contains(player))
|
||||
mult = 1.5;
|
||||
|
||||
//Exp
|
||||
int expGained = (int)(time*gems*mult);
|
||||
//Exp
|
||||
int expGained = (int)((timeExp + gemExp)*mult);
|
||||
|
||||
//Record Global and per Game
|
||||
addStat(player, "ExpEarned", expGained, false, true);
|
||||
|
@ -17,11 +17,13 @@ import mineplex.core.common.util.WorldUtil;
|
||||
import mineplex.core.common.util.ZipUtil;
|
||||
import mineplex.core.timing.TimingManager;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.games.uhc.UHC;
|
||||
import net.minecraft.server.v1_7_R4.ChunkPreLoadEvent;
|
||||
|
||||
import org.bukkit.Difficulty;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||
|
||||
@ -80,7 +82,30 @@ public class WorldData
|
||||
{
|
||||
TimingManager.start("WorldData loading world.");
|
||||
//Start World
|
||||
World = WorldUtil.LoadWorld(new WorldCreator(GetFolder()));
|
||||
|
||||
if (Host instanceof UHC)
|
||||
{
|
||||
//Delete Old World
|
||||
File dir = new File(GetFolder() + "/data");
|
||||
FileUtil.DeleteFolder(dir);
|
||||
|
||||
dir = new File(GetFolder() + "/region");
|
||||
FileUtil.DeleteFolder(dir);
|
||||
|
||||
dir = new File(GetFolder() + "/level.dat");
|
||||
dir.delete();
|
||||
|
||||
//Create Fresh World with Random Seed
|
||||
WorldCreator creator = new WorldCreator(GetFolder());
|
||||
creator.seed(UtilMath.r(999999999));
|
||||
creator.environment(Environment.NORMAL);
|
||||
creator.generateStructures(true);
|
||||
World = creator.createWorld();
|
||||
}
|
||||
else
|
||||
{
|
||||
World = WorldUtil.LoadWorld(new WorldCreator(GetFolder()));
|
||||
}
|
||||
TimingManager.stop("WorldData loading world.");
|
||||
|
||||
World.setDifficulty(Difficulty.HARD);
|
||||
|
Loading…
Reference in New Issue
Block a user