Final changes for S2
This commit is contained in:
parent
a8e3a530c1
commit
5e1fcabe36
@ -71,7 +71,7 @@ import static mineplex.core.Managers.require;
|
||||
|
||||
public class Clans extends JavaPlugin
|
||||
{
|
||||
public static final String MAP = "Map 1";
|
||||
public static final String MAP = "Season 2";
|
||||
private String WEB_CONFIG = "webServer";
|
||||
|
||||
// Modules
|
||||
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Chunk;
|
||||
@ -24,6 +23,7 @@ import mineplex.game.clans.clans.event.ClanDisbandedEvent;
|
||||
import mineplex.game.clans.clans.event.PlayerClaimTerritoryEvent;
|
||||
import mineplex.game.clans.clans.event.PlayerPreClaimTerritoryEvent;
|
||||
import mineplex.game.clans.clans.event.PlayerUnClaimTerritoryEvent;
|
||||
import mineplex.game.clans.clans.nether.NetherPortal;
|
||||
import mineplex.game.clans.core.repository.ClanTerritory;
|
||||
import mineplex.game.clans.spawn.Spawn;
|
||||
|
||||
@ -289,6 +289,16 @@ public class ClansUtility
|
||||
|
||||
public boolean isSafe(Location loc)
|
||||
{
|
||||
if (_clansManager.getNetherManager().getNetherWorld().equals(loc.getWorld()))
|
||||
{
|
||||
for (NetherPortal portal : _clansManager.getNetherManager().getReturnPortals())
|
||||
{
|
||||
if (UtilMath.offset2d(loc, portal.getLocation()) <= 5)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fix for PC-279
|
||||
// Do not change to getChunk
|
||||
// PlayerList#updatePlayers -> iterator -> PlayerVelocityEvent -> getChunk -> loadChunk -> loadPersistentEntities -> addTracker -> ITERATE ON SAME SET
|
||||
|
@ -1,6 +1,7 @@
|
||||
package mineplex.game.clans.clans.ban;
|
||||
|
||||
import mineplex.core.common.util.UUIDFetcher;
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.database.MinecraftRepository;
|
||||
import mineplex.serverdata.database.DBPool;
|
||||
import mineplex.serverdata.database.column.ColumnInt;
|
||||
@ -92,17 +93,11 @@ public class ClansBanRepository extends MinecraftRepository
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated This invokes a mojang UUID query and should be replaced.
|
||||
* It's called infrequently enough (i.e., only when a moderator
|
||||
* invokes /cban), so not entirely pressing.
|
||||
*/
|
||||
@Deprecated
|
||||
public CompletableFuture<Optional<ClansBanClient>> loadClient(String name)
|
||||
{
|
||||
// Yes, this is garbage.
|
||||
// Yes, it would be better implemented in a functional language.
|
||||
return CompletableFuture.supplyAsync(() -> UUIDFetcher.getUUIDOf(name))
|
||||
return CompletableFuture.supplyAsync(() -> Managers.get(CoreClientManager.class).loadUUIDFromDB(name))
|
||||
.thenCompose(uuid ->
|
||||
{
|
||||
if (uuid == null)
|
||||
|
@ -16,7 +16,6 @@ public class ClansBanCommand extends CommandBase<ClansBanManager>
|
||||
super(plugin, Rank.CMOD, "cbans", "cb", "cban", "cp", "cpunish", "clanspunish", "clanpunish");
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void Execute(final Player caller, String[] args)
|
||||
{
|
||||
@ -43,7 +42,7 @@ public class ClansBanCommand extends CommandBase<ClansBanManager>
|
||||
{
|
||||
if (!maybeClient.isPresent())
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + "Could not find player with name " + C.cYellow + " " + playerName);
|
||||
UtilPlayer.message(caller, C.cRed + "Could not find player with name " + C.cYellow + playerName);
|
||||
} else
|
||||
{
|
||||
new ClansBanShop(Plugin, playerName, maybeClient.get(), finalReason).attemptShopOpen(caller);
|
||||
|
@ -12,6 +12,7 @@ import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.ClanTips.TipType;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.spawn.Spawn;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -245,15 +246,13 @@ public class BossNetherPortal implements Listener
|
||||
ClansManager.getInstance().getNetherManager().OverworldOrigins.remove((Player)event.getEntity());
|
||||
((Player)event.getEntity()).removePotionEffect(PotionEffectType.NIGHT_VISION);
|
||||
UtilPlayer.message(event.getEntity(), F.main(ClansManager.getInstance().getNetherManager().getName(), "You have escaped " + F.clansNether("The Nether") + "!"));
|
||||
ClansManager.getInstance().runSyncLater(() ->
|
||||
{
|
||||
ClansManager.getInstance().getCombatManager().Get((Player)event.getEntity()).SetLastCombatEngaged(System.currentTimeMillis());
|
||||
}, 20);
|
||||
ClansManager.getInstance().getCombatManager().Get((Player)event.getEntity()).SetLastCombatEngaged(System.currentTimeMillis() - Spawn.COMBAT_TAG_DURATION);
|
||||
}
|
||||
else
|
||||
{
|
||||
ClansManager.getInstance().getNetherManager().InNether.put((Player)event.getEntity(), Expire);
|
||||
event.getEntity().teleport(ClansManager.getInstance().getNetherManager().getNetherWorld().getSpawnLocation());
|
||||
ClansManager.getInstance().getCombatManager().Get((Player)event.getEntity()).SetLastCombatEngaged(System.currentTimeMillis() - Spawn.COMBAT_TAG_DURATION);
|
||||
ClansManager.getInstance().ClanTips.displayTip(TipType.ENTER_NETHER, (Player)event.getEntity());
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package mineplex.game.clans.clans.nether;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
@ -21,7 +21,6 @@ import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.EntityPortalEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerPortalEvent;
|
||||
@ -74,9 +73,9 @@ public class NetherManager extends MiniPlugin
|
||||
private List<NetherPortal> _portals = Lists.newArrayList();
|
||||
public List<BossNetherPortal> BossPortals = Lists.newArrayList();
|
||||
private List<NetherPortal> _returnPortals = Lists.newArrayList();
|
||||
public HashMap<Player, Long> InNether = new HashMap<>();
|
||||
public HashMap<Player, Location> OverworldOrigins = new HashMap<>();
|
||||
public HashMap<Player, ClaimData> Claiming = new HashMap<>();
|
||||
public Map<Player, Long> InNether = new HashMap<>();
|
||||
public Map<Player, Location> OverworldOrigins = new HashMap<>();
|
||||
public Map<Player, ClaimData> Claiming = new HashMap<>();
|
||||
|
||||
public NetherManager(ClansManager manager)
|
||||
{
|
||||
@ -183,6 +182,11 @@ public class NetherManager extends MiniPlugin
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<NetherPortal> getReturnPortals()
|
||||
{
|
||||
return _returnPortals;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a nether portal into the manager
|
||||
* @param portal The portal to load
|
||||
@ -389,6 +393,7 @@ public class NetherManager extends MiniPlugin
|
||||
OverworldOrigins.remove(event.getPlayer());
|
||||
event.getPlayer().removePotionEffect(PotionEffectType.NIGHT_VISION);
|
||||
UtilPlayer.message(event.getPlayer(), F.main(getName(), "You have escaped " + F.clansNether("The Nether") + "!"));
|
||||
ClansManager.getInstance().getCombatManager().Get(event.getPlayer()).SetLastCombatEngaged(System.currentTimeMillis() - Spawn.COMBAT_TAG_DURATION);
|
||||
}, 1);
|
||||
}
|
||||
|
||||
@ -415,6 +420,7 @@ public class NetherManager extends MiniPlugin
|
||||
player.teleport(getReturnLocation(player));
|
||||
OverworldOrigins.remove(player);
|
||||
player.removePotionEffect(PotionEffectType.NIGHT_VISION);
|
||||
ClansManager.getInstance().getCombatManager().Get(player).SetLastCombatEngaged(System.currentTimeMillis() - Spawn.COMBAT_TAG_DURATION);
|
||||
UtilPlayer.message(player, F.main(getName(), "You have been forced to escape " + F.clansNether("The Nether") + " to survive its demonic poisons!"));
|
||||
}
|
||||
}
|
||||
@ -531,29 +537,4 @@ public class NetherManager extends MiniPlugin
|
||||
spawnBossPortal(event.getCreature().getEvent().getCenterLocation().clone().subtract(0, 1, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onCommand(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (event.getMessage().toUpperCase().startsWith("/TRYDOUBLES") && event.getPlayer().isOp())
|
||||
{
|
||||
int mult = 1;
|
||||
if (event.getMessage().toUpperCase().equalsIgnoreCase("/TRYDOUBLES 2"))
|
||||
{
|
||||
mult = 2;
|
||||
}
|
||||
if (event.getMessage().toUpperCase().equalsIgnoreCase("/TRYDOUBLES 3"))
|
||||
{
|
||||
mult = 3;
|
||||
}
|
||||
for (int i = 0; i < 100 * mult; i++)
|
||||
{
|
||||
double d = new Random().nextDouble();
|
||||
if (d <= 0.075)
|
||||
{
|
||||
Bukkit.broadcastMessage("FOUND ONE - " + d);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -11,6 +11,7 @@ import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.ClanTips.TipType;
|
||||
import mineplex.game.clans.spawn.Spawn;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -256,15 +257,13 @@ public class NetherPortal implements Listener
|
||||
ClansManager.getInstance().getNetherManager().OverworldOrigins.remove((Player)event.getEntity());
|
||||
((Player)event.getEntity()).removePotionEffect(PotionEffectType.NIGHT_VISION);
|
||||
UtilPlayer.message(event.getEntity(), F.main(ClansManager.getInstance().getNetherManager().getName(), "You have escaped " + F.clansNether("The Nether") + "!"));
|
||||
ClansManager.getInstance().runSyncLater(() ->
|
||||
{
|
||||
ClansManager.getInstance().getCombatManager().Get((Player)event.getEntity()).SetLastCombatEngaged(System.currentTimeMillis());
|
||||
}, 20);
|
||||
ClansManager.getInstance().getCombatManager().Get((Player)event.getEntity()).SetLastCombatEngaged(System.currentTimeMillis() - Spawn.COMBAT_TAG_DURATION);
|
||||
}
|
||||
else
|
||||
{
|
||||
ClansManager.getInstance().getNetherManager().InNether.put((Player)event.getEntity(), Expire);
|
||||
event.getEntity().teleport(ClansManager.getInstance().getNetherManager().getNetherWorld().getSpawnLocation());
|
||||
ClansManager.getInstance().getCombatManager().Get((Player)event.getEntity()).SetLastCombatEngaged(System.currentTimeMillis() - Spawn.COMBAT_TAG_DURATION);
|
||||
ClansManager.getInstance().ClanTips.displayTip(TipType.ENTER_NETHER, (Player)event.getEntity());
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ import org.bukkit.potion.PotionEffectType;
|
||||
public class ArcherMiniboss extends NetherMiniBoss<Skeleton>
|
||||
{
|
||||
private static final int BARBED_LEVEL = 1;
|
||||
private static final double RUNE_DROP_CHANCE = .075;
|
||||
private static final double RUNE_DROP_CHANCE = .02;
|
||||
private static final int MAX_DIAMOND_DROPS = 5;
|
||||
|
||||
public ArcherMiniboss(String displayName, Double maxHealth, Location spawn, EntityType type)
|
||||
|
@ -31,7 +31,7 @@ public class GhastMiniboss extends NetherMiniBoss<Ghast>
|
||||
private static final long MAIN_FIREBALL_COOLDOWN = 5000;
|
||||
private static final long FIREBALL_LAUNCH_RATE = 500;
|
||||
private static final int FIREBALLS_PER_USE = 5;
|
||||
private static final double RUNE_DROP_CHANCE = .075;
|
||||
private static final double RUNE_DROP_CHANCE = .02;
|
||||
private static final int MAX_DIAMOND_DROPS = 5;
|
||||
private static final double MAX_TARGET_RANGE = 25;
|
||||
private long _lastFireballUse;
|
||||
|
@ -32,7 +32,7 @@ import org.bukkit.potion.PotionEffectType;
|
||||
*/
|
||||
public class WarriorMiniboss extends NetherMiniBoss<Zombie>
|
||||
{
|
||||
private static final double RUNE_DROP_CHANCE = .075;
|
||||
private static final double RUNE_DROP_CHANCE = .02;
|
||||
private static final int MAX_DIAMOND_DROPS = 5;
|
||||
private static final double LEAP_CHANCE = .9;
|
||||
private static final double LEAP_MIN_DIST = 3;
|
||||
|
@ -32,7 +32,7 @@ public abstract class AttackAttribute extends ItemAttribute
|
||||
{
|
||||
if(event.IsCancelled() || event.isCancelled()) return;
|
||||
_attackCount++;
|
||||
System.out.println("Attack count " + _attackCount + " - " + _attackLimit);
|
||||
// System.out.println("Attack count " + _attackCount + " - " + _attackLimit);
|
||||
if (_attackCount >= _attackLimit)
|
||||
{
|
||||
_attackCount = 0;
|
||||
|
@ -5,17 +5,20 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import mineplex.game.clans.items.attributes.AttributeType;
|
||||
import mineplex.game.clans.items.attributes.ItemAttribute;
|
||||
import mineplex.game.clans.items.generation.ValueDistribution;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
// A.K.A Conquering for Armor
|
||||
public class ConqueringArmorAttribute extends FlatReductionAttribute
|
||||
public class ConqueringArmorAttribute extends ItemAttribute
|
||||
{
|
||||
private static ValueDistribution reductionGen = generateDistribution(1.0d, 4.0d);
|
||||
private static ReductionConfig config = new ReductionConfig();
|
||||
private static ValueDistribution reductionGen = generateDistribution(2.5d, 6.25d);
|
||||
private double _reduction;
|
||||
|
||||
public ConqueringArmorAttribute()
|
||||
{
|
||||
super(AttributeType.SUFFIX, reductionGen, config);
|
||||
super(AttributeType.SUFFIX);
|
||||
_reduction = reductionGen.generateValue() / 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -23,14 +26,30 @@ public class ConqueringArmorAttribute extends FlatReductionAttribute
|
||||
{
|
||||
return "Conquering";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttacked(CustomDamageEvent event)
|
||||
{
|
||||
DamageCause cause = event.GetCause();
|
||||
Entity attacker = event.GetDamagerEntity(true);
|
||||
|
||||
if (reducesDamage(cause, attacker))
|
||||
{
|
||||
event.AddMult("Conquering Armor", new String(), 1 - _reduction, false);
|
||||
// System.out.println("Reduced damage by " + reduction);
|
||||
}
|
||||
else
|
||||
{
|
||||
// System.out.println("Armor doesn't reduce " + cause);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription()
|
||||
{
|
||||
return String.format("-%.1f damage taken from mobs & bosses", getFlatReduction());
|
||||
return String.format("%.1f%% damage taken from mobs & bosses", (1 - _reduction) * 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean reducesDamage(DamageCause cause, Entity attacker)
|
||||
{
|
||||
return !(attacker instanceof Player); // Reduces damage from all entities
|
||||
|
@ -36,7 +36,7 @@ public abstract class ReductionAttribute extends ItemAttribute
|
||||
double damage = event.GetDamage();
|
||||
double reduction = getDamageReduction(damage);
|
||||
event.AddMod("Reduction Armor", -reduction);
|
||||
System.out.println("Reduced damage by " + reduction);
|
||||
// System.out.println("Reduced damage by " + reduction);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -9,7 +9,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class ConqueringAttribute extends DamageAttribute
|
||||
{
|
||||
private static ValueDistribution damageGen = generateDistribution(1.0d, 6.0d);
|
||||
private static ValueDistribution damageGen = generateDistribution(1.0d, 4.0d);
|
||||
|
||||
public ConqueringAttribute()
|
||||
{
|
||||
|
@ -314,6 +314,10 @@ public class Spawn extends MiniPlugin
|
||||
|
||||
for (LivingEntity entity : getSpawnWorld().getLivingEntities())
|
||||
{
|
||||
if (entity.hasMetadata("CombatLogNPC"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (entity instanceof Monster)
|
||||
{
|
||||
Monster monster = (Monster) entity;
|
||||
|
Loading…
Reference in New Issue
Block a user