some fixes and updates

This commit is contained in:
Ben 2016-03-10 02:47:48 +00:00
parent 9b40496a1e
commit 2d2e88e069
6 changed files with 51 additions and 59 deletions

View File

@ -144,6 +144,28 @@ public class Recipes extends MiniPlugin
chainBoots2.setIngredient('S', Material.IRON_INGOT);
UtilServer.getServer().addRecipe(chainBoots2);
ShapedRecipe stonebrick = new ShapedRecipe(new ItemStack(Material.SMOOTH_BRICK, 1));
stonebrick.shape("SS#", "SS#");
stonebrick.setIngredient('S', Material.STONE);
UtilServer.getServer().addRecipe(stonebrick);
stonebrick = new ShapedRecipe(new ItemStack(Material.SMOOTH_BRICK, 1));
stonebrick.shape("#SS", "#SS");
stonebrick.setIngredient('S', Material.STONE);
UtilServer.getServer().addRecipe(stonebrick);
stonebrick = new ShapedRecipe(new ItemStack(Material.SMOOTH_BRICK, 1));
stonebrick.shape("###", "SS#", "SS#");
stonebrick.setIngredient('S', Material.STONE);
UtilServer.getServer().addRecipe(stonebrick);
stonebrick = new ShapedRecipe(new ItemStack(Material.SMOOTH_BRICK, 1));
stonebrick.shape("###", "#SS", "#SS");
stonebrick.setIngredient('S', Material.STONE);
UtilServer.getServer().addRecipe(stonebrick);
}
@EventHandler(priority = EventPriority.LOW)

View File

@ -18,6 +18,12 @@ public class KillCommand extends CommandBase<DamageManager>
@Override
public void Execute(Player caller, String[] args)
{
if ((System.currentTimeMillis() - Plugin.GetCombatManager().Get(caller).GetLastDamaged()) >= 30000)
{
UtilPlayer.message(caller, F.main("Clans", "You cannot use this command whilst in combat."));
return;
}
UtilPlayer.message(caller, F.main("Clans", "You have imploded."));
caller.setHealth(0D);

View File

@ -140,6 +140,7 @@ public class SiegeWeaponRepository extends MinecraftRepository
protected void initialize()
{
executeUpdate(CREATE);
executeUpdate("ALTER TABLE `Account`.`clans` ADD COLUMN `eloRating` INT(11) NOT NULL DEFAULT '1200' AFTER `generatorStock`;");
}
@Override

View File

@ -1,19 +1,17 @@
package mineplex.game.clans.clans.worldevent;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import mineplex.core.common.util.EnclosedObject;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilItem.ItemCategory;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilWorld;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.regions.ClansRegions;
@ -38,65 +36,24 @@ public class EventTerrainFinder
public Location findAreaInBorderlands(World world, int size, int vert)
{
int borderlandsDist = 31;
int borderlandsWidth = 47 - borderlandsDist;
for (int i = 0; i < 20; i++)
for (int i = 0; i < 150; i++)
{
int x = 0;
int z = 0;
EnclosedObject<Location> loc = new EnclosedObject<>();
x = (borderlandsDist * 16) + (UtilMath.clamp(UtilMath.random.nextInt(borderlandsWidth), 2, borderlandsWidth - 2) * 16);
z = (borderlandsDist * 16) + (UtilMath.clamp(UtilMath.random.nextInt(borderlandsWidth), 2, borderlandsWidth - 2) * 16);
_clansManager.getClanUtility().getClanByClanName("Borderlands").getClaimSet().stream().filter(claim -> Math.random() > .5).filter(claim -> Math.random() > .5).filter(claim -> Math.random() > .3).filter(claim -> Math.random() > .7).limit(1).forEach(claim -> {
Chunk chunk = UtilWorld.strToChunk(claim);
loc.Set(UtilBlock.getHighest(chunk.getWorld(), chunk.getBlock(0, 0, 0)).getLocation());
});
if (UtilMath.random.nextBoolean())
{
x = -x;
z = -z;
}
Location loc = UtilBlock.getHighest(world, x, z).getLocation();
int blocks = ((size * 2) + 1) * ((size * 2) + 1);
boolean suitable = true;
int liquids = 0;
for (x = -size; x < size; x++)
{
for (z = -size; z < size; z++)
{
Block topBlock = loc.getWorld().getBlockAt(loc.getBlockX() + x, UtilBlock.getHighest(loc.getWorld(), loc.getBlockX() + x, loc.getBlockZ() + z, new HashSet<Material>(UtilItem.listIn(ItemCategory.BOUNDLESS))).getY(), loc.getBlockZ());
if (255 - topBlock.getY() < size)
{
suitable = false;
continue;
}
if (topBlock.isLiquid())
{
liquids++;
}
}
}
if (liquids > 1 && (((double) blocks)) / ((double) liquids) > 0.25)
{
System.out.println("water bad");
suitable = false;
}
// If this region is not suitable, try again.
if (!suitable)
{
if (loc.Get() == null)
continue;
}
System.out.println("Done finding area... [success]");
// Success
return loc;
return loc.Get();
}
System.out.println("Done finding area...");

View File

@ -39,7 +39,7 @@ public class MeridianScepter extends LegendaryItem
public MeridianScepter()
{
super("Meridian Scepter", UtilText.splitLinesToArray(new String[] {
C.cWhite + "Legend says "
C.cWhite + "Legend says that this scepter was found, and retrieved from the deepest trench in all of Minecraftia. It is said that the scepter gains it's magical powers from Poseidon himself."
+ " ",
"#" + C.cYellow + "Right-Click" + C.cWhite + " to use Scepter."
}, LineFormat.LORE), Material.RECORD_6);

View File

@ -16,6 +16,7 @@ import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
@ -27,6 +28,7 @@ import mineplex.game.clans.items.PlayerGear;
public class RunedPickaxe extends RareItem
{
private long _instamineEnabled;
private boolean _enabled;
static
{
@ -50,10 +52,12 @@ public class RunedPickaxe extends RareItem
RunedPickaxe pick = (RunedPickaxe) gear.getWeapon();
if ((System.currentTimeMillis() - pick._instamineEnabled) >= 12000
&& Recharge.Instance.usable(player, "Instant Mine"))
if (pick._enabled
&& (System.currentTimeMillis() - pick._instamineEnabled) >= 12000)
{
Recharge.Instance.use(player, "Instant Mine", 15 * 1000, true, true);
pick._enabled = false;
}
});
}
@ -106,9 +110,11 @@ public class RunedPickaxe extends RareItem
return;
}
if (Recharge.Instance.usable(event.getPlayer(), "Instant Mine", true) && (UtilTime.elapsed(_instamineEnabled, 12000)))
if (Recharge.Instance.usable(event.getPlayer(), "Instant Mine", true))
{
UtilTextMiddle.display("", "Instant mine enabled for " + F.elem("12 Seconds"), 20, 80, 20, event.getPlayer());
_instamineEnabled = System.currentTimeMillis();
_enabled = true;
}
super.onInteract(event);