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