More progress towards 1.13

This commit is contained in:
ZeroEpoch1969
2018-07-24 19:08:29 -07:00
parent 6275fd8bcb
commit 7170b1c999
29 changed files with 164 additions and 136 deletions

View File

@ -12,7 +12,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Place a cage around someone.", usage = "/<command> <purge | off | <partialname> [skull | block] [blockname | skullname]")
@CommandParameters(description = "Place a cage around someone.", usage = "/<command> <purge | off | <partialname> [skull | block] [blockname | playername]")
public class Command_cage extends FreedomCommand
{
@ -62,11 +62,15 @@ public class Command_cage extends FreedomCommand
}
case "skull":
{
outerMaterial = Material.SKULL;
outerMaterial = Material.PLAYER_HEAD;
if (args.length >= 3)
{
skullName = args[2];
}
else
{
outerMaterial = Material.SKELETON_SKULL;
}
break;
}
case "block":
@ -81,17 +85,6 @@ public class Command_cage extends FreedomCommand
}
}
}
if (args.length >= 3)
{
if (args[2].equalsIgnoreCase("water"))
{
innerMaterial = Material.STATIONARY_WATER;
}
else if (args[2].equalsIgnoreCase("lava"))
{
innerMaterial = Material.STATIONARY_LAVA;
}
}
Location location = player.getLocation().clone().add(0.0, 1.0, 0.0);
if (skullName != null)
{
@ -102,7 +95,7 @@ public class Command_cage extends FreedomCommand
fPlayer.getCageData().cage(location, outerMaterial, innerMaterial);
}
player.setGameMode(GameMode.SURVIVAL);
if (outerMaterial == Material.SKULL && skullName != null)
if (outerMaterial == Material.PLAYER_HEAD)
{
FUtil.adminAction(sender.getName(), "Caging " + player.getName() + " in " + skullName, true);
}

View File

@ -0,0 +1,35 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.Arrays;
import java.util.List;
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Get a stuck of happiness.", usage = "/<command>")
public class Command_debugstick extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
ItemStack itemStack = new ItemStack(Material.DEBUG_STICK);
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.setDisplayName(ChatColor.GOLD.toString() + ChatColor.BOLD.toString() + "Stick of Happiness");
List<String> lore = Arrays.asList(
ChatColor.RED + "This is the most powerfull stick in the game.",
ChatColor.DARK_BLUE + "You can left click to select what you want to change.",
ChatColor.DARK_GREEN + "And then you can right click to change it!",
ChatColor.DARK_PURPLE + "Isn't technology amazing?");
itemMeta.setLore(lore);
itemStack.setItemMeta(itemMeta);
playerSender.getInventory().addItem(itemStack);
return true;
}
}

View File

@ -3,7 +3,6 @@ package me.totalfreedom.totalfreedommod.command;
import java.util.ArrayList;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.Location;
@ -44,16 +43,6 @@ public class Command_dispfill extends FreedomCommand
for (final String searchItem : itemsRaw)
{
Material material = Material.matchMaterial(searchItem);
if (material == null)
{
try
{
material = DepreciationAggregator.getMaterial(Integer.parseInt(searchItem));
}
catch (NumberFormatException ex)
{
}
}
if (material != null)
{

View File

@ -38,7 +38,7 @@ public class Command_mp44 extends FreedomCommand
msg("mp44 is ARMED! Left click with gunpowder to start firing, left click again to quit.", ChatColor.GREEN);
msg("Type /mp44 sling to disable. -by Madgeek1450", ChatColor.GREEN);
playerSender.getEquipment().setItemInMainHand(new ItemStack(Material.SULPHUR, 1));
playerSender.getEquipment().setItemInMainHand(new ItemStack(Material.GUNPOWDER, 1));
}
else
{

View File

@ -3,8 +3,8 @@ package me.totalfreedom.totalfreedommod.command;
import java.util.ArrayList;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
import me.totalfreedom.totalfreedommod.util.FUtil;
import me.totalfreedom.totalfreedommod.util.MaterialGroup;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@ -29,28 +29,26 @@ public class Command_ro extends FreedomCommand
}
final List<Material> materials = new ArrayList<>();
for (String materialName : StringUtils.split(args[0], ","))
String names = null;
if (args[0].equalsIgnoreCase("shulker_boxes") || args[0].equalsIgnoreCase("shulkers"))
{
Material fromMaterial = Material.matchMaterial(materialName);
if (fromMaterial == null)
materials.addAll(MaterialGroup.SHULKER_BOX_COLORS);
names = "shulker boxes";
}
else
{
for (String materialName : StringUtils.split(args[0], ","))
{
try
{
fromMaterial = DepreciationAggregator.getMaterial(Integer.parseInt(materialName));
}
catch (NumberFormatException ex)
{
}
}
Material fromMaterial = Material.matchMaterial(materialName);
if (fromMaterial == null || fromMaterial == Material.AIR || !fromMaterial.isBlock())
{
msg("Invalid material: " + materialName, ChatColor.RED);
return true;
}
if (fromMaterial == null || fromMaterial == Material.AIR || !fromMaterial.isBlock())
{
msg("Invalid material: " + materialName, ChatColor.RED);
return true;
}
materials.add(fromMaterial);
materials.add(fromMaterial);
}
}
int radius = 20;
@ -82,7 +80,10 @@ public class Command_ro extends FreedomCommand
targetPlayer = null;
}
final String names = StringUtils.join(materials, ", ");
if (names == null)
{
names = StringUtils.join(materials, ", ");
}
World adminWorld = null;
try

View File

@ -2,14 +2,15 @@ package me.totalfreedom.totalfreedommod.command;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.material.Lever;
@CommandPermissions(level = Rank.NON_OP, source = SourceType.BOTH)
@CommandParameters(description = "Set the on/off state of the lever at position x, y, z in world 'worldname'.", usage = "/<command> <x> <y> <z> <worldname> <on|off>")
@ -63,10 +64,11 @@ public class Command_setlever extends FreedomCommand
if (targetBlock.getType() == Material.LEVER)
{
org.bukkit.material.Lever lever = DepreciationAggregator.makeLeverWithData(DepreciationAggregator.getData_Block(targetBlock));
BlockState state = targetBlock.getState();
Lever lever = (Lever) state.getData();
lever.setPowered(leverOn);
DepreciationAggregator.setData_Block(targetBlock, DepreciationAggregator.getData_MaterialData(lever));
targetBlock.getState().update();
state.setData(lever);
state.update();
}
else
{

View File

@ -2,12 +2,7 @@ package me.totalfreedom.totalfreedommod.command;
import java.util.ArrayList;
import java.util.List;
import me.totalfreedom.totalfreedommod.command.CommandParameters;
import me.totalfreedom.totalfreedommod.command.CommandPermissions;
import me.totalfreedom.totalfreedommod.command.FreedomCommand;
import me.totalfreedom.totalfreedommod.command.SourceType;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.Material;
@ -32,20 +27,10 @@ public class Command_whohas extends FreedomCommand
final String materialName = args[0];
Material material = Material.matchMaterial(materialName);
if (material == null)
{
try
{
material = DepreciationAggregator.getMaterial(Integer.parseInt(materialName));
}
catch (NumberFormatException ex)
{
}
}
if (material == null)
{
msg("Invalid block: " + materialName, ChatColor.RED);
msg("Invalid item: " + materialName, ChatColor.RED);
return true;
}