More progress towards 1.13

This commit is contained in:
ZeroEpoch1969 2018-07-24 19:08:29 -07:00
parent 6275fd8bcb
commit 7170b1c999
No known key found for this signature in database
GPG Key ID: A7BAB4E14F089CF3
29 changed files with 164 additions and 136 deletions

View File

@ -464,7 +464,7 @@ public class FrontDoor extends FreedomService
continue; continue;
} }
block.setType(Material.SIGN_POST); block.setType(Material.SIGN);
org.bukkit.block.Sign sign = (org.bukkit.block.Sign) block.getState(); org.bukkit.block.Sign sign = (org.bukkit.block.Sign) block.getState();
org.bukkit.material.Sign signData = (org.bukkit.material.Sign) sign.getData(); org.bukkit.material.Sign signData = (org.bukkit.material.Sign) sign.getData();
@ -542,7 +542,7 @@ public class FrontDoor extends FreedomService
FUtil.adminAction("FrontDoor", "Caging " + player.getName() + " in PURE_DARTH", true); FUtil.adminAction("FrontDoor", "Caging " + player.getName() + " in PURE_DARTH", true);
Location targetPos = player.getLocation().clone().add(0, 1, 0); Location targetPos = player.getLocation().clone().add(0, 1, 0);
playerdata.getCageData().cage(targetPos, Material.SKULL, Material.AIR); playerdata.getCageData().cage(targetPos, Material.PLAYER_HEAD, Material.AIR, "Prozza");
break; break;
} }

View File

@ -33,11 +33,6 @@ public class Monitors extends FreedomService
{ {
} }
public String getMaterial(final int id)
{
return String.valueOf(Material.getMaterial(id)).replace("_", " ").toLowerCase();
}
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onLingeringPotionSplash(LingeringPotionSplashEvent event) public void onLingeringPotionSplash(LingeringPotionSplashEvent event)
{ {
@ -53,14 +48,14 @@ public class Monitors extends FreedomService
{ {
return; return;
} }
final int droppedItem = event.getEntity().getItem().getTypeId(); final Material droppedItem = event.getEntity().getItem().getType();
final Location location = player.getLocation(); final Location location = player.getLocation();
for (Player p : server.getOnlinePlayers()) for (Player p : server.getOnlinePlayers())
{ {
if (plugin.al.isAdmin(p) && plugin.al.getAdmin(p).getPotionSpy()) if (plugin.al.isAdmin(p) && plugin.al.getAdmin(p).getPotionSpy())
{ {
FUtil.playerMsg(p, potionSpyPrefix + ChatColor.WHITE + player.getName() + " splashed " + event.getEntity().getItem().getAmount() + " " + getMaterial(droppedItem) + " at X: " + decimalFormat.format(location.getX()) + ", Y: " + decimalFormat.format(location.getY()) + ", Z: " + decimalFormat.format(location.getZ()) + ", in the world '" + location.getWorld().getName() + "'."); FUtil.playerMsg(p, potionSpyPrefix + ChatColor.WHITE + player.getName() + " splashed " + event.getEntity().getItem().getAmount() + " " + droppedItem + " at X: " + decimalFormat.format(location.getX()) + ", Y: " + decimalFormat.format(location.getY()) + ", Z: " + decimalFormat.format(location.getZ()) + ", in the world '" + location.getWorld().getName() + "'.");
} }
} }
} }
@ -80,14 +75,14 @@ public class Monitors extends FreedomService
{ {
return; return;
} }
final int droppedItem = event.getPotion().getItem().getTypeId(); final Material droppedItem = event.getPotion().getItem().getType();
final Location location = player.getLocation(); final Location location = player.getLocation();
for (Player p : server.getOnlinePlayers()) for (Player p : server.getOnlinePlayers())
{ {
if (plugin.al.isAdmin(p) && plugin.al.getAdmin(p).getPotionSpy()) if (plugin.al.isAdmin(p) && plugin.al.getAdmin(p).getPotionSpy())
{ {
FUtil.playerMsg(p, potionSpyPrefix + ChatColor.WHITE + player.getName() + " splashed " + event.getEntity().getItem().getAmount() + " " + getMaterial(droppedItem) + " at X: " + decimalFormat.format(location.getX()) + ", Y: " + decimalFormat.format(location.getY()) + ", Z: " + decimalFormat.format(location.getZ()) + ", in the world '" + location.getWorld().getName() + "'."); FUtil.playerMsg(p, potionSpyPrefix + ChatColor.WHITE + player.getName() + " splashed " + event.getEntity().getItem().getAmount() + " " + droppedItem + " at X: " + decimalFormat.format(location.getX()) + ", Y: " + decimalFormat.format(location.getY()) + ", Z: " + decimalFormat.format(location.getZ()) + ", in the world '" + location.getWorld().getName() + "'.");
} }
} }
} }

View File

@ -39,7 +39,6 @@ public class BlockBlocker extends FreedomService
switch (event.getBlockPlaced().getType()) switch (event.getBlockPlaced().getType())
{ {
case LAVA: case LAVA:
case STATIONARY_LAVA:
{ {
if (ConfigEntry.ALLOW_LAVA_PLACE.getBoolean()) if (ConfigEntry.ALLOW_LAVA_PLACE.getBoolean())
{ {
@ -54,7 +53,6 @@ public class BlockBlocker extends FreedomService
break; break;
} }
case WATER: case WATER:
case STATIONARY_WATER:
{ {
if (ConfigEntry.ALLOW_WATER_PLACE.getBoolean()) if (ConfigEntry.ALLOW_WATER_PLACE.getBoolean())
{ {

View File

@ -83,7 +83,7 @@ public class InteractBlocker extends FreedomService
break; break;
} }
case EXPLOSIVE_MINECART: case TNT_MINECART:
{ {
if (ConfigEntry.ALLOW_TNT_MINECARTS.getBoolean()) if (ConfigEntry.ALLOW_TNT_MINECARTS.getBoolean())
{ {

View File

@ -9,6 +9,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Trident;
public class PVPBlocker extends FreedomService public class PVPBlocker extends FreedomService
{ {
@ -48,6 +49,14 @@ public class PVPBlocker extends FreedomService
player = (Player) arrow.getShooter(); player = (Player) arrow.getShooter();
} }
} }
else if (event.getDamager() instanceof Trident)
{
Trident trident = (Trident) event.getDamager();
if (trident.getShooter() instanceof Player)
{
player = (Player) trident.getShooter();
}
}
} }
if (player != null &! plugin.al.isAdmin(player)) if (player != null &! plugin.al.isAdmin(player))

View File

@ -38,7 +38,7 @@ public class SignBlocker extends FreedomService
{ {
final Player player = event.getPlayer(); final Player player = event.getPlayer();
if (event.getBlock().getType().equals(Material.SIGN) || event.getBlock().getType().equals(Material.SIGN_POST) || event.getBlock().getType().equals(Material.WALL_SIGN)) if (event.getBlock().getType().equals(Material.SIGN) || event.getBlock().getType().equals(Material.WALL_SIGN))
{ {
ItemStack sign = event.getItemInHand(); ItemStack sign = event.getItemInHand();
@ -65,7 +65,7 @@ public class SignBlocker extends FreedomService
return; return;
} }
if (event.getClickedBlock() != null && event.getClickedBlock().getType().equals(Material.SIGN) || event.getClickedBlock().getType().equals(Material.SIGN_POST) || event.getClickedBlock().getType().equals(Material.WALL_SIGN)) if (event.getClickedBlock() != null && event.getClickedBlock().getType().equals(Material.SIGN) || event.getClickedBlock().getType().equals(Material.WALL_SIGN))
{ {
event.setCancelled(true); event.setCancelled(true);
} }

View File

@ -185,7 +185,7 @@ public class CageData
final Block block = center.getRelative(xOffset, yOffset, zOffset); final Block block = center.getRelative(xOffset, yOffset, zOffset);
if (material != Material.SKULL) if (material != Material.PLAYER_HEAD)
{ {
// Glowstone light // Glowstone light
if (material != Material.GLASS && xOffset == 0 && yOffset == 2 && zOffset == 0) if (material != Material.GLASS && xOffset == 0 && yOffset == 2 && zOffset == 0)
@ -204,11 +204,11 @@ public class CageData
continue; continue;
} }
block.setType(Material.SKULL); block.setType(Material.PLAYER_HEAD);
if (input != null) if (input != null)
{ {
Skull skull = (Skull) block.getState(); Skull skull = (Skull) block.getState();
skull.setSkullType(SkullType.PLAYER); // This may or may not work in future versions of spigot
skull.setOwner(input); skull.setOwner(input);
skull.update(); skull.update();
} }

View File

@ -12,7 +12,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @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 public class Command_cage extends FreedomCommand
{ {
@ -62,11 +62,15 @@ public class Command_cage extends FreedomCommand
} }
case "skull": case "skull":
{ {
outerMaterial = Material.SKULL; outerMaterial = Material.PLAYER_HEAD;
if (args.length >= 3) if (args.length >= 3)
{ {
skullName = args[2]; skullName = args[2];
} }
else
{
outerMaterial = Material.SKELETON_SKULL;
}
break; break;
} }
case "block": 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); Location location = player.getLocation().clone().add(0.0, 1.0, 0.0);
if (skullName != null) if (skullName != null)
{ {
@ -102,7 +95,7 @@ public class Command_cage extends FreedomCommand
fPlayer.getCageData().cage(location, outerMaterial, innerMaterial); fPlayer.getCageData().cage(location, outerMaterial, innerMaterial);
} }
player.setGameMode(GameMode.SURVIVAL); 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); 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.ArrayList;
import java.util.List; import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.bukkit.Location; import org.bukkit.Location;
@ -44,16 +43,6 @@ public class Command_dispfill extends FreedomCommand
for (final String searchItem : itemsRaw) for (final String searchItem : itemsRaw)
{ {
Material material = Material.matchMaterial(searchItem); Material material = Material.matchMaterial(searchItem);
if (material == null)
{
try
{
material = DepreciationAggregator.getMaterial(Integer.parseInt(searchItem));
}
catch (NumberFormatException ex)
{
}
}
if (material != null) 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("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); 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 else
{ {

View File

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

View File

@ -2,14 +2,15 @@ package me.totalfreedom.totalfreedommod.command;
import java.util.List; import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.material.Lever;
@CommandPermissions(level = Rank.NON_OP, source = SourceType.BOTH) @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>") @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) 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); lever.setPowered(leverOn);
DepreciationAggregator.setData_Block(targetBlock, DepreciationAggregator.getData_MaterialData(lever)); state.setData(lever);
targetBlock.getState().update(); state.update();
} }
else else
{ {

View File

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

View File

@ -56,17 +56,11 @@ public class ItemFun extends FreedomService
switch (event.getMaterial()) switch (event.getMaterial())
{ {
case RAW_FISH: case TROPICAL_FISH:
{ {
final int RADIUS_HIT = 5; final int RADIUS_HIT = 5;
final int STRENGTH = 4; final int STRENGTH = 4;
// Clownfish
if (DepreciationAggregator.getData_MaterialData(event.getItem().getData()) != 2)
{
break;
}
if (!plugin.al.isSeniorAdmin(player)) if (!plugin.al.isSeniorAdmin(player))
{ {
final StringBuilder msg = new StringBuilder(); final StringBuilder msg = new StringBuilder();
@ -77,7 +71,7 @@ public class ItemFun extends FreedomService
} }
player.sendMessage(msg.toString()); player.sendMessage(msg.toString());
player.getEquipment().getItemInMainHand().setType(Material.POTATO_ITEM); player.getEquipment().getItemInMainHand().setType(Material.POTATO);
break; break;
} }
@ -126,7 +120,7 @@ public class ItemFun extends FreedomService
break; break;
} }
case CARROT_ITEM: case CARROT:
{ {
if (!ConfigEntry.ALLOW_EXPLOSIONS.getBoolean()) if (!ConfigEntry.ALLOW_EXPLOSIONS.getBoolean())
{ {
@ -214,7 +208,7 @@ public class ItemFun extends FreedomService
break; break;
} }
case SULPHUR: case GUNPOWDER:
{ {
if (!fPlayer.isMP44Armed()) if (!fPlayer.isMP44Armed())
{ {

View File

@ -6,7 +6,7 @@ import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import org.bukkit.Material; import me.totalfreedom.totalfreedommod.util.MaterialGroup;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -16,7 +16,6 @@ import org.bukkit.util.Vector;
public class Jumppads extends FreedomService public class Jumppads extends FreedomService
{ {
public static final Material BLOCK_ID = Material.WOOL;
public static final double DAMPING_COEFFICIENT = 0.8; public static final double DAMPING_COEFFICIENT = 0.8;
// //
private final Map<Player, Boolean> pushMap = Maps.newHashMap(); private final Map<Player, Boolean> pushMap = Maps.newHashMap();
@ -64,7 +63,7 @@ public class Jumppads extends FreedomService
{ {
canPush = true; canPush = true;
} }
if (block.getRelative(0, -1, 0).getType() == BLOCK_ID) if (MaterialGroup.WOOL_COLORS.contains(block.getRelative(0, -1, 0).getType()))
{ {
if (canPush) if (canPush)
{ {
@ -80,29 +79,29 @@ public class Jumppads extends FreedomService
} }
else else
{ {
if (block.getRelative(0, -1, 0).getType() == BLOCK_ID) if (MaterialGroup.WOOL_COLORS.contains(block.getRelative(0, -1, 0).getType()))
{ {
velocity.add(new Vector(0.0, strength, 0.0)); velocity.add(new Vector(0.0, strength, 0.0));
} }
if (mode == JumpPadMode.NORMAL_AND_SIDEWAYS) if (mode == JumpPadMode.NORMAL_AND_SIDEWAYS)
{ {
if (block.getRelative(1, 0, 0).getType() == BLOCK_ID) if (MaterialGroup.WOOL_COLORS.contains(block.getRelative(1, 0, 0).getType()))
{ {
velocity.add(new Vector(-DAMPING_COEFFICIENT * strength, 0.0, 0.0)); velocity.add(new Vector(-DAMPING_COEFFICIENT * strength, 0.0, 0.0));
} }
if (block.getRelative(-1, 0, 0).getType() == BLOCK_ID) if (MaterialGroup.WOOL_COLORS.contains(block.getRelative(-1, 0, 0).getType()))
{ {
velocity.add(new Vector(DAMPING_COEFFICIENT * strength, 0.0, 0.0)); velocity.add(new Vector(DAMPING_COEFFICIENT * strength, 0.0, 0.0));
} }
if (block.getRelative(0, 0, 1).getType() == BLOCK_ID) if (MaterialGroup.WOOL_COLORS.contains(block.getRelative(0, 0, 1).getType()))
{ {
velocity.add(new Vector(0.0, 0.0, -DAMPING_COEFFICIENT * strength)); velocity.add(new Vector(0.0, 0.0, -DAMPING_COEFFICIENT * strength));
} }
if (block.getRelative(0, 0, -1).getType() == BLOCK_ID) if (MaterialGroup.WOOL_COLORS.contains(block.getRelative(0, 0, -1).getType()))
{ {
velocity.add(new Vector(0.0, 0.0, DAMPING_COEFFICIENT * strength)); velocity.add(new Vector(0.0, 0.0, DAMPING_COEFFICIENT * strength));
} }

View File

@ -44,7 +44,7 @@ public class MobStacker extends FreedomService
ItemStack item = attacker.getInventory().getItemInMainHand(); ItemStack item = attacker.getInventory().getItemInMainHand();
if (item != null && item.getType().equals(Material.POTATO_ITEM)) if (item != null && item.getType().equals(Material.POTATO))
{ {
event.setCancelled(true); event.setCancelled(true);
attacker.addPassenger(event.getEntity()); attacker.addPassenger(event.getEntity());

View File

@ -2,6 +2,7 @@ package me.totalfreedom.totalfreedommod.fun;
import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.util.MaterialGroup;
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator; import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -10,7 +11,6 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
import java.util.HashSet; import java.util.HashSet;
import java.util.Random; import java.util.Random;
import java.util.Set; import java.util.Set;
@ -66,8 +66,7 @@ public class Trailer extends FreedomService
} }
final Location location = fromBlock.getLocation(); final Location location = fromBlock.getLocation();
fromBlock.setType(Material.WOOL); fromBlock.setType(MaterialGroup.WOOL_COLORS.get(random.nextInt(MaterialGroup.WOOL_COLORS.size())));
DepreciationAggregator.setData_Block(fromBlock, (byte) random.nextInt(16));
byte data = DepreciationAggregator.getData_Block(fromBlock); byte data = DepreciationAggregator.getData_Block(fromBlock);
Material material = Material.getMaterial(String.valueOf(fromBlock.getType())); Material material = Material.getMaterial(String.valueOf(fromBlock.getType()));
for (int x = -1; x <= 1; x++) for (int x = -1; x <= 1; x++)

View File

@ -6,6 +6,7 @@ import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
public class RollbackEntry public class RollbackEntry
{ {
@ -16,7 +17,7 @@ public class RollbackEntry
public final int x; public final int x;
public final short y; public final short y;
public final int z; public final int z;
public final byte data; public final BlockData data;
public final Material blockMaterial; public final Material blockMaterial;
private final boolean isBreak; private final boolean isBreak;
@ -33,13 +34,13 @@ public class RollbackEntry
if (entryType == EntryType.BLOCK_BREAK) if (entryType == EntryType.BLOCK_BREAK)
{ {
this.blockMaterial = block.getType(); this.blockMaterial = block.getType();
this.data = DepreciationAggregator.getData_Block(block); this.data = block.getBlockData();
this.isBreak = true; this.isBreak = true;
} }
else else
{ {
this.blockMaterial = block.getType(); this.blockMaterial = block.getType();
this.data = DepreciationAggregator.getData_Block(block); this.data = block.getBlockData();
this.isBreak = false; this.isBreak = false;
} }
} }
@ -73,7 +74,7 @@ public class RollbackEntry
if (isBreak) if (isBreak)
{ {
block.setType(getMaterial()); block.setType(getMaterial());
DepreciationAggregator.setData_Block(block, data); block.setBlockData(data);
} }
else else
{ {
@ -92,7 +93,7 @@ public class RollbackEntry
else else
{ {
block.setType(getMaterial()); block.setType(getMaterial());
DepreciationAggregator.setData_Block(block, data); block.setBlockData(data);
} }
} }
} }

View File

@ -275,7 +275,7 @@ public class RollbackManager extends FreedomService
for (RollbackEntry entry : entries) for (RollbackEntry entry : entries)
{ {
FUtil.playerMsg(player, " - " + ChatColor.BLUE + entry.author + " " + entry.getType() + " " FUtil.playerMsg(player, " - " + ChatColor.BLUE + entry.author + " " + entry.getType() + " "
+ StringUtils.capitalize(entry.getMaterial().toString().toLowerCase()) + (entry.data == 0 ? "" : ":" + entry.data)); + StringUtils.capitalize(entry.getMaterial().toString().toLowerCase()) + (entry.data == null ? "" : ":" + entry.data));
} }
} }
} }

View File

@ -24,11 +24,6 @@ public class DepreciationAggregator
return server.getOfflinePlayer(name); return server.getOfflinePlayer(name);
} }
public static Material getMaterial(int id)
{
return Material.getMaterial(id);
}
public static byte getData_MaterialData(MaterialData md) public static byte getData_MaterialData(MaterialData md)
{ {
return md.getData(); return md.getData();
@ -44,21 +39,11 @@ public class DepreciationAggregator
return block.getData(); return block.getData();
} }
public static void setData_Block(Block block, byte data)
{
block.setData(data);
}
public static org.bukkit.material.Lever makeLeverWithData(byte data) public static org.bukkit.material.Lever makeLeverWithData(byte data)
{ {
return new org.bukkit.material.Lever(Material.LEVER, data); return new org.bukkit.material.Lever(Material.LEVER, data);
} }
public static int getTypeId_Block(Block block)
{
return block.getTypeId();
}
public static String getName_EntityType(EntityType et) public static String getName_EntityType(EntityType et)
{ {
return et.getName(); return et.getName();

View File

@ -26,6 +26,7 @@ import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.Material;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitTask; import org.bukkit.scheduler.BukkitTask;

View File

@ -0,0 +1,43 @@
package me.totalfreedom.totalfreedommod.util;
import org.bukkit.Material;
import java.util.Arrays;
import java.util.List;
public class MaterialGroup
{
public static final List<Material> WOOL_COLORS = Arrays.asList(
Material.WHITE_WOOL,
Material.RED_WOOL,
Material.ORANGE_WOOL,
Material.YELLOW_WOOL,
Material.GREEN_WOOL,
Material.LIME_WOOL,
Material.LIGHT_BLUE_WOOL,
Material.CYAN_WOOL,
Material.BLUE_WOOL,
Material.PURPLE_WOOL,
Material.MAGENTA_WOOL,
Material.PINK_WOOL,
Material.BROWN_WOOL,
Material.GRAY_WOOL,
Material.LIGHT_GRAY_WOOL,
Material.BLACK_WOOL);
public static final List<Material> SHULKER_BOX_COLORS = Arrays.asList(
Material.WHITE_SHULKER_BOX,
Material.RED_SHULKER_BOX,
Material.ORANGE_SHULKER_BOX,
Material.YELLOW_SHULKER_BOX,
Material.GREEN_SHULKER_BOX,
Material.LIME_SHULKER_BOX,
Material.LIGHT_BLUE_SHULKER_BOX,
Material.CYAN_SHULKER_BOX,
Material.BLUE_SHULKER_BOX,
Material.PURPLE_SHULKER_BOX,
Material.MAGENTA_SHULKER_BOX,
Material.PINK_SHULKER_BOX,
Material.BROWN_SHULKER_BOX,
Material.GRAY_SHULKER_BOX,
Material.LIGHT_GRAY_SHULKER_BOX,
Material.BLACK_SHULKER_BOX);
}

View File

@ -68,7 +68,7 @@ public final class AdminWorld extends CustomWorld
world.setSpawnLocation(0, 50, 0); world.setSpawnLocation(0, 50, 0);
final Block welcomeSignBlock = world.getBlockAt(0, 50, 0); final Block welcomeSignBlock = world.getBlockAt(0, 50, 0);
welcomeSignBlock.setType(Material.SIGN_POST); welcomeSignBlock.setType(Material.SIGN);
org.bukkit.block.Sign welcomeSign = (org.bukkit.block.Sign) welcomeSignBlock.getState(); org.bukkit.block.Sign welcomeSign = (org.bukkit.block.Sign) welcomeSignBlock.getState();
org.bukkit.material.Sign signData = (org.bukkit.material.Sign) welcomeSign.getData(); org.bukkit.material.Sign signData = (org.bukkit.material.Sign) welcomeSign.getData();

View File

@ -52,7 +52,8 @@ public class CleanroomBlockPopulator extends BlockPopulator
{ {
for (int zz = 0; zz < 16; zz++) for (int zz = 0; zz < 16; zz++)
{ {
world.getBlockAt(x + xx, y, z + zz).setData(dataValue); // xd dont know what im gonna do, ill come back to this later
//world.getBlockAt(x + xx, y, z + zz).setData(dataValue);
} }
} }
} }

View File

@ -102,7 +102,7 @@ public class CleanroomChunkGenerator extends ChunkGenerator
try try
{ {
// Mabe it's an integer? // Mabe it's an integer?
mat = Material.getMaterial(Integer.parseInt(materialTokens[0])); mat = Material.getMaterial(String.valueOf(materialTokens[0]));
} }
catch (Exception e) catch (Exception e)
{ {
@ -181,7 +181,6 @@ public class CleanroomChunkGenerator extends ChunkGenerator
} }
} }
@Override
public short[][] generateExtBlockSections(World world, Random random, int x, int z, BiomeGrid biomes) public short[][] generateExtBlockSections(World world, Random random, int x, int z, BiomeGrid biomes)
{ {
int maxHeight = world.getMaxHeight(); int maxHeight = world.getMaxHeight();

View File

@ -46,7 +46,7 @@ public class Flatlands extends CustomWorld
world.setSpawnLocation(0, 50, 0); world.setSpawnLocation(0, 50, 0);
final Block welcomeSignBlock = world.getBlockAt(0, 50, 0); final Block welcomeSignBlock = world.getBlockAt(0, 50, 0);
welcomeSignBlock.setType(Material.SIGN_POST); welcomeSignBlock.setType(Material.SIGN);
org.bukkit.block.Sign welcomeSign = (org.bukkit.block.Sign) welcomeSignBlock.getState(); org.bukkit.block.Sign welcomeSign = (org.bukkit.block.Sign) welcomeSignBlock.getState();
org.bukkit.material.Sign signData = (org.bukkit.material.Sign) welcomeSign.getData(); org.bukkit.material.Sign signData = (org.bukkit.material.Sign) welcomeSign.getData();

View File

@ -55,7 +55,7 @@ public final class MasterBuilderWorld extends CustomWorld
world.setSpawnLocation(0, 50, 0); world.setSpawnLocation(0, 50, 0);
final Block welcomeSignBlock = world.getBlockAt(0, 50, 0); final Block welcomeSignBlock = world.getBlockAt(0, 50, 0);
welcomeSignBlock.setType(Material.SIGN_POST); welcomeSignBlock.setType(Material.SIGN);
org.bukkit.block.Sign welcomeSign = (org.bukkit.block.Sign) welcomeSignBlock.getState(); org.bukkit.block.Sign welcomeSign = (org.bukkit.block.Sign) welcomeSignBlock.getState();
org.bukkit.material.Sign signData = (org.bukkit.material.Sign) welcomeSign.getData(); org.bukkit.material.Sign signData = (org.bukkit.material.Sign) welcomeSign.getData();

View File

@ -5,5 +5,4 @@ description: Plugin for the Total Freedom server.
depend: [Aero] depend: [Aero]
softdepend: [BukkitTelnet, Essentials, LibsDisguises] softdepend: [BukkitTelnet, Essentials, LibsDisguises]
authors: [Madgeek1450, Prozza] authors: [Madgeek1450, Prozza]
api-version: 1.13
# plugin.yml is no longer used to define commands.