mirror of
https://github.com/essentials/Essentials.git
synced 2025-03-14 17:10:21 +01:00
Merge branch 'master' of github.com:khobbits/Essentials
This commit is contained in:
commit
31136f971c
@ -1,5 +1,6 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.TargetBlock;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.TreeType;
|
||||
import com.earth2me.essentials.User;
|
||||
@ -31,30 +32,12 @@ public class Commandbigtree extends EssentialsCommand
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
double x = user.getLocation().getX();
|
||||
double y = user.getLocation().getY();
|
||||
double z = user.getLocation().getZ();
|
||||
|
||||
// offset tree in direction player is facing
|
||||
final int r = (int)user.getCorrectedYaw();
|
||||
if (r < 68 || r > 292) // north
|
||||
final int[] ignore =
|
||||
{
|
||||
x -= 3.0D;
|
||||
}
|
||||
else if (r > 112 && r < 248) // south
|
||||
{
|
||||
x += 3.0D;
|
||||
}
|
||||
if (r > 22 && r < 158) // east
|
||||
{
|
||||
z -= 3.0D;
|
||||
}
|
||||
else if (r > 202 && r < 338) // west
|
||||
{
|
||||
z += 3.0D;
|
||||
}
|
||||
|
||||
final Location safeLocation = Util.getSafeDestination(new Location(user.getWorld(), x, y, z));
|
||||
8, 9
|
||||
};
|
||||
final Location loc = (new TargetBlock(user, 300, 0.2, ignore)).getTargetBlock().getLocation();
|
||||
final Location safeLocation = Util.getSafeDestination(loc);
|
||||
final boolean success = user.getWorld().generateTree(safeLocation, (TreeType)tree);
|
||||
if (success)
|
||||
{
|
||||
|
@ -16,6 +16,7 @@ public class Commandgive extends EssentialsCommand
|
||||
super("give");
|
||||
}
|
||||
|
||||
//TODO: move these messages to message file
|
||||
@Override
|
||||
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
||||
{
|
||||
|
@ -45,6 +45,7 @@ public class Commandlist extends EssentialsCommand
|
||||
}
|
||||
}
|
||||
charge(sender);
|
||||
//TODO: move these to messages file
|
||||
StringBuilder online = new StringBuilder();
|
||||
online.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().length - playerHidden);
|
||||
if (showhidden && playerHidden > 0)
|
||||
|
@ -83,17 +83,10 @@ public class Commandspawnmob extends EssentialsCommand
|
||||
8, 9
|
||||
};
|
||||
Location loc = (new TargetBlock(user, 300, 0.2, ignore)).getTargetBlock().getLocation();
|
||||
|
||||
Block block = user.getWorld().getBlockAt(loc);
|
||||
while (!(block.getType() == Material.AIR || block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER))
|
||||
{
|
||||
loc.setY(loc.getY() + 1);
|
||||
block = user.getWorld().getBlockAt(loc);
|
||||
}
|
||||
|
||||
Location sloc = Util.getSafeDestination(loc);
|
||||
try
|
||||
{
|
||||
spawnedMob = mob.spawn(user, server, loc);
|
||||
spawnedMob = mob.spawn(user, server, sloc);
|
||||
}
|
||||
catch (MobException e)
|
||||
{
|
||||
|
@ -15,6 +15,7 @@ public class Commandtogglejail extends EssentialsCommand
|
||||
super("togglejail");
|
||||
}
|
||||
|
||||
//TODO: move these to messages file
|
||||
@Override
|
||||
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
||||
{
|
||||
|
@ -1,10 +1,13 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.TargetBlock;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.TreeType;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
|
||||
public class Commandtree extends EssentialsCommand
|
||||
@ -38,32 +41,14 @@ public class Commandtree extends EssentialsCommand
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
double x = user.getLocation().getX();
|
||||
double y = user.getLocation().getY();
|
||||
double z = user.getLocation().getZ();
|
||||
|
||||
// offset tree in direction player is facing
|
||||
int r = (int)user.getCorrectedYaw();
|
||||
if (r < 68 || r > 292) // north
|
||||
|
||||
final int[] ignore =
|
||||
{
|
||||
x -= 3.0D;
|
||||
}
|
||||
else if (r > 112 && r < 248) // south
|
||||
{
|
||||
x += 3.0D;
|
||||
}
|
||||
if (r > 22 && r < 158) // east
|
||||
{
|
||||
z -= 3.0D;
|
||||
}
|
||||
else if (r > 202 && r < 338) // west
|
||||
{
|
||||
z += 3.0D;
|
||||
}
|
||||
|
||||
Location safeLocation = Util.getSafeDestination(new Location(user.getWorld(), x, y, z));
|
||||
boolean success = user.getWorld().generateTree(safeLocation, (TreeType)tree);
|
||||
8, 9
|
||||
};
|
||||
final Location loc = (new TargetBlock(user, 300, 0.2, ignore)).getTargetBlock().getLocation();
|
||||
final Location safeLocation = Util.getSafeDestination(loc);
|
||||
final boolean success = user.getWorld().generateTree(safeLocation, (TreeType)tree);
|
||||
if (success)
|
||||
{
|
||||
charge(user);
|
||||
|
@ -41,6 +41,7 @@ public class SignProtection extends EssentialsSign
|
||||
sign.setLine(3, "§1" + username);
|
||||
return true;
|
||||
}
|
||||
//TODO: move to messages
|
||||
player.sendMessage("§4You are not allowed to create sign here.");
|
||||
return false;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class SignTrade extends EssentialsSign
|
||||
{
|
||||
validateTrade(sign, 1, false, ess);
|
||||
validateTrade(sign, 2, true, ess);
|
||||
final Trade charge = getTrade(sign, 2, true, false, ess);
|
||||
final Trade charge = getTrade(sign, 2, true, true, ess);
|
||||
charge.isAffordableFor(player);
|
||||
sign.setLine(3, "§8" + username);
|
||||
charge.charge(player);
|
||||
|
Loading…
x
Reference in New Issue
Block a user