mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-30 02:05:41 +00:00
More progress towards 1.13
This commit is contained in:
parent
6275fd8bcb
commit
7170b1c999
@ -464,7 +464,7 @@ public class FrontDoor extends FreedomService
|
||||
continue;
|
||||
}
|
||||
|
||||
block.setType(Material.SIGN_POST);
|
||||
block.setType(Material.SIGN);
|
||||
org.bukkit.block.Sign sign = (org.bukkit.block.Sign) block.getState();
|
||||
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
public void onLingeringPotionSplash(LingeringPotionSplashEvent event)
|
||||
{
|
||||
@ -53,14 +48,14 @@ public class Monitors extends FreedomService
|
||||
{
|
||||
return;
|
||||
}
|
||||
final int droppedItem = event.getEntity().getItem().getTypeId();
|
||||
final Material droppedItem = event.getEntity().getItem().getType();
|
||||
final Location location = player.getLocation();
|
||||
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
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;
|
||||
}
|
||||
final int droppedItem = event.getPotion().getItem().getTypeId();
|
||||
final Material droppedItem = event.getPotion().getItem().getType();
|
||||
final Location location = player.getLocation();
|
||||
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
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() + "'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,6 @@ public class BlockBlocker extends FreedomService
|
||||
switch (event.getBlockPlaced().getType())
|
||||
{
|
||||
case LAVA:
|
||||
case STATIONARY_LAVA:
|
||||
{
|
||||
if (ConfigEntry.ALLOW_LAVA_PLACE.getBoolean())
|
||||
{
|
||||
@ -54,7 +53,6 @@ public class BlockBlocker extends FreedomService
|
||||
break;
|
||||
}
|
||||
case WATER:
|
||||
case STATIONARY_WATER:
|
||||
{
|
||||
if (ConfigEntry.ALLOW_WATER_PLACE.getBoolean())
|
||||
{
|
||||
|
@ -83,7 +83,7 @@ public class InteractBlocker extends FreedomService
|
||||
break;
|
||||
}
|
||||
|
||||
case EXPLOSIVE_MINECART:
|
||||
case TNT_MINECART:
|
||||
{
|
||||
if (ConfigEntry.ALLOW_TNT_MINECARTS.getBoolean())
|
||||
{
|
||||
|
@ -9,6 +9,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Trident;
|
||||
|
||||
public class PVPBlocker extends FreedomService
|
||||
{
|
||||
@ -48,6 +49,14 @@ public class PVPBlocker extends FreedomService
|
||||
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))
|
||||
|
@ -38,7 +38,7 @@ public class SignBlocker extends FreedomService
|
||||
{
|
||||
|
||||
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();
|
||||
@ -65,7 +65,7 @@ public class SignBlocker extends FreedomService
|
||||
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);
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ public class CageData
|
||||
|
||||
final Block block = center.getRelative(xOffset, yOffset, zOffset);
|
||||
|
||||
if (material != Material.SKULL)
|
||||
if (material != Material.PLAYER_HEAD)
|
||||
{
|
||||
// Glowstone light
|
||||
if (material != Material.GLASS && xOffset == 0 && yOffset == 2 && zOffset == 0)
|
||||
@ -204,11 +204,11 @@ public class CageData
|
||||
continue;
|
||||
}
|
||||
|
||||
block.setType(Material.SKULL);
|
||||
block.setType(Material.PLAYER_HEAD);
|
||||
if (input != null)
|
||||
{
|
||||
Skull skull = (Skull) block.getState();
|
||||
skull.setSkullType(SkullType.PLAYER);
|
||||
// This may or may not work in future versions of spigot
|
||||
skull.setOwner(input);
|
||||
skull.update();
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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,20 +29,17 @@ public class Command_ro extends FreedomCommand
|
||||
}
|
||||
|
||||
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], ","))
|
||||
{
|
||||
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())
|
||||
{
|
||||
@ -52,6 +49,7 @@ public class Command_ro extends FreedomCommand
|
||||
|
||||
materials.add(fromMaterial);
|
||||
}
|
||||
}
|
||||
|
||||
int radius = 20;
|
||||
if (args.length >= 2)
|
||||
@ -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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -56,17 +56,11 @@ public class ItemFun extends FreedomService
|
||||
|
||||
switch (event.getMaterial())
|
||||
{
|
||||
case RAW_FISH:
|
||||
case TROPICAL_FISH:
|
||||
{
|
||||
final int RADIUS_HIT = 5;
|
||||
final int STRENGTH = 4;
|
||||
|
||||
// Clownfish
|
||||
if (DepreciationAggregator.getData_MaterialData(event.getItem().getData()) != 2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (!plugin.al.isSeniorAdmin(player))
|
||||
{
|
||||
final StringBuilder msg = new StringBuilder();
|
||||
@ -77,7 +71,7 @@ public class ItemFun extends FreedomService
|
||||
}
|
||||
player.sendMessage(msg.toString());
|
||||
|
||||
player.getEquipment().getItemInMainHand().setType(Material.POTATO_ITEM);
|
||||
player.getEquipment().getItemInMainHand().setType(Material.POTATO);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -126,7 +120,7 @@ public class ItemFun extends FreedomService
|
||||
break;
|
||||
}
|
||||
|
||||
case CARROT_ITEM:
|
||||
case CARROT:
|
||||
{
|
||||
if (!ConfigEntry.ALLOW_EXPLOSIONS.getBoolean())
|
||||
{
|
||||
@ -214,7 +208,7 @@ public class ItemFun extends FreedomService
|
||||
break;
|
||||
}
|
||||
|
||||
case SULPHUR:
|
||||
case GUNPOWDER:
|
||||
{
|
||||
if (!fPlayer.isMP44Armed())
|
||||
{
|
||||
|
@ -6,7 +6,7 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import org.bukkit.Material;
|
||||
import me.totalfreedom.totalfreedommod.util.MaterialGroup;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -16,7 +16,6 @@ import org.bukkit.util.Vector;
|
||||
public class Jumppads extends FreedomService
|
||||
{
|
||||
|
||||
public static final Material BLOCK_ID = Material.WOOL;
|
||||
public static final double DAMPING_COEFFICIENT = 0.8;
|
||||
//
|
||||
private final Map<Player, Boolean> pushMap = Maps.newHashMap();
|
||||
@ -64,7 +63,7 @@ public class Jumppads extends FreedomService
|
||||
{
|
||||
canPush = true;
|
||||
}
|
||||
if (block.getRelative(0, -1, 0).getType() == BLOCK_ID)
|
||||
if (MaterialGroup.WOOL_COLORS.contains(block.getRelative(0, -1, 0).getType()))
|
||||
{
|
||||
if (canPush)
|
||||
{
|
||||
@ -80,29 +79,29 @@ public class Jumppads extends FreedomService
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class MobStacker extends FreedomService
|
||||
|
||||
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);
|
||||
attacker.addPassenger(event.getEntity());
|
||||
|
@ -2,6 +2,7 @@ package me.totalfreedom.totalfreedommod.fun;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.util.MaterialGroup;
|
||||
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -10,7 +11,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
@ -66,8 +66,7 @@ public class Trailer extends FreedomService
|
||||
}
|
||||
|
||||
final Location location = fromBlock.getLocation();
|
||||
fromBlock.setType(Material.WOOL);
|
||||
DepreciationAggregator.setData_Block(fromBlock, (byte) random.nextInt(16));
|
||||
fromBlock.setType(MaterialGroup.WOOL_COLORS.get(random.nextInt(MaterialGroup.WOOL_COLORS.size())));
|
||||
byte data = DepreciationAggregator.getData_Block(fromBlock);
|
||||
Material material = Material.getMaterial(String.valueOf(fromBlock.getType()));
|
||||
for (int x = -1; x <= 1; x++)
|
||||
|
@ -6,6 +6,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
public class RollbackEntry
|
||||
{
|
||||
@ -16,7 +17,7 @@ public class RollbackEntry
|
||||
public final int x;
|
||||
public final short y;
|
||||
public final int z;
|
||||
public final byte data;
|
||||
public final BlockData data;
|
||||
public final Material blockMaterial;
|
||||
private final boolean isBreak;
|
||||
|
||||
@ -33,13 +34,13 @@ public class RollbackEntry
|
||||
if (entryType == EntryType.BLOCK_BREAK)
|
||||
{
|
||||
this.blockMaterial = block.getType();
|
||||
this.data = DepreciationAggregator.getData_Block(block);
|
||||
this.data = block.getBlockData();
|
||||
this.isBreak = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.blockMaterial = block.getType();
|
||||
this.data = DepreciationAggregator.getData_Block(block);
|
||||
this.data = block.getBlockData();
|
||||
this.isBreak = false;
|
||||
}
|
||||
}
|
||||
@ -73,7 +74,7 @@ public class RollbackEntry
|
||||
if (isBreak)
|
||||
{
|
||||
block.setType(getMaterial());
|
||||
DepreciationAggregator.setData_Block(block, data);
|
||||
block.setBlockData(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -92,7 +93,7 @@ public class RollbackEntry
|
||||
else
|
||||
{
|
||||
block.setType(getMaterial());
|
||||
DepreciationAggregator.setData_Block(block, data);
|
||||
block.setBlockData(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ public class RollbackManager extends FreedomService
|
||||
for (RollbackEntry entry : entries)
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,11 +24,6 @@ public class DepreciationAggregator
|
||||
return server.getOfflinePlayer(name);
|
||||
}
|
||||
|
||||
public static Material getMaterial(int id)
|
||||
{
|
||||
return Material.getMaterial(id);
|
||||
}
|
||||
|
||||
public static byte getData_MaterialData(MaterialData md)
|
||||
{
|
||||
return md.getData();
|
||||
@ -44,21 +39,11 @@ public class DepreciationAggregator
|
||||
return block.getData();
|
||||
}
|
||||
|
||||
public static void setData_Block(Block block, byte data)
|
||||
{
|
||||
block.setData(data);
|
||||
}
|
||||
|
||||
public static org.bukkit.material.Lever makeLeverWithData(byte 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)
|
||||
{
|
||||
return et.getName();
|
||||
|
@ -26,6 +26,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
@ -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);
|
||||
}
|
@ -68,7 +68,7 @@ public final class AdminWorld extends CustomWorld
|
||||
world.setSpawnLocation(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.material.Sign signData = (org.bukkit.material.Sign) welcomeSign.getData();
|
||||
|
@ -52,7 +52,8 @@ public class CleanroomBlockPopulator extends BlockPopulator
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ public class CleanroomChunkGenerator extends ChunkGenerator
|
||||
try
|
||||
{
|
||||
// Mabe it's an integer?
|
||||
mat = Material.getMaterial(Integer.parseInt(materialTokens[0]));
|
||||
mat = Material.getMaterial(String.valueOf(materialTokens[0]));
|
||||
}
|
||||
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)
|
||||
{
|
||||
int maxHeight = world.getMaxHeight();
|
||||
|
@ -46,7 +46,7 @@ public class Flatlands extends CustomWorld
|
||||
world.setSpawnLocation(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.material.Sign signData = (org.bukkit.material.Sign) welcomeSign.getData();
|
||||
|
@ -55,7 +55,7 @@ public final class MasterBuilderWorld extends CustomWorld
|
||||
world.setSpawnLocation(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.material.Sign signData = (org.bukkit.material.Sign) welcomeSign.getData();
|
||||
|
@ -5,5 +5,4 @@ description: Plugin for the Total Freedom server.
|
||||
depend: [Aero]
|
||||
softdepend: [BukkitTelnet, Essentials, LibsDisguises]
|
||||
authors: [Madgeek1450, Prozza]
|
||||
|
||||
# plugin.yml is no longer used to define commands.
|
||||
api-version: 1.13
|
||||
|
Loading…
Reference in New Issue
Block a user