mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-30 10:05:59 +00:00
Clean up sources of compile warnings.
Move anything that causes deprecation warnings into TFM_DepreciationAggregator if no alternative implementation possible.
This commit is contained in:
parent
2b597867f0
commit
183277db21
@ -29,7 +29,7 @@ public class Command_cbtool extends TFM_Command
|
||||
|
||||
if ("targetblock".equalsIgnoreCase(args[0]) && sender instanceof Player)
|
||||
{
|
||||
Block targetBlock = sender_p.getTargetBlock(null, 100);
|
||||
Block targetBlock = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getTargetBlock(sender_p, null, 100);
|
||||
playerMsg("Your target block: " + targetBlock.getLocation().toString());
|
||||
return true;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class Command_deop extends TFM_Command
|
||||
// if the player is not online
|
||||
if (player == null)
|
||||
{
|
||||
player = server.getOfflinePlayer(args[0]);
|
||||
player = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getOfflinePlayer(server, args[0]);
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "De-opping " + player.getName(), false);
|
||||
|
@ -35,52 +35,51 @@ public class Command_dispfill extends TFM_Command
|
||||
return true;
|
||||
}
|
||||
|
||||
String[] items_raw = StringUtils.split(args[1], ",");
|
||||
List<ItemStack> items = new ArrayList<ItemStack>();
|
||||
for (String search_item : items_raw)
|
||||
final List<ItemStack> items = new ArrayList<ItemStack>();
|
||||
|
||||
final String[] itemsRaw = StringUtils.split(args[1], ",");
|
||||
for (final String searchItem : itemsRaw)
|
||||
{
|
||||
ItemStack is = null;
|
||||
|
||||
is = new ItemStack(Material.matchMaterial(search_item), 64);
|
||||
|
||||
if (is == null)
|
||||
Material material = Material.matchMaterial(searchItem);
|
||||
if (material == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
is = new ItemStack(Integer.parseInt(search_item), 64);
|
||||
material = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getMaterial(Integer.parseInt(searchItem));
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (is != null)
|
||||
if (material != null)
|
||||
{
|
||||
items.add(is);
|
||||
items.add(new ItemStack(material, 64));
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage("Skipping invalid item: " + search_item);
|
||||
sender.sendMessage("Skipping invalid item: " + searchItem);
|
||||
}
|
||||
}
|
||||
ItemStack[] items_array = items.toArray(new ItemStack[items.size()]);
|
||||
|
||||
final ItemStack[] itemsArray = items.toArray(new ItemStack[items.size()]);
|
||||
|
||||
int affected = 0;
|
||||
Location center_location = sender_p.getLocation();
|
||||
Block center_block = center_location.getBlock();
|
||||
for (int x_offset = -radius; x_offset <= radius; x_offset++)
|
||||
final Location centerLocation = sender_p.getLocation();
|
||||
final Block centerBlock = centerLocation.getBlock();
|
||||
for (int xOffset = -radius; xOffset <= radius; xOffset++)
|
||||
{
|
||||
for (int y_offset = -radius; y_offset <= radius; y_offset++)
|
||||
for (int yOffset = -radius; yOffset <= radius; yOffset++)
|
||||
{
|
||||
for (int z_offset = -radius; z_offset <= radius; z_offset++)
|
||||
for (int zOffset = -radius; zOffset <= radius; zOffset++)
|
||||
{
|
||||
Block targetBlock = center_block.getRelative(x_offset, y_offset, z_offset);
|
||||
if (targetBlock.getLocation().distanceSquared(center_location) < (radius * radius))
|
||||
final Block targetBlock = centerBlock.getRelative(xOffset, yOffset, zOffset);
|
||||
if (targetBlock.getLocation().distanceSquared(centerLocation) < (radius * radius))
|
||||
{
|
||||
if (targetBlock.getType().equals(Material.DISPENSER))
|
||||
{
|
||||
sender.sendMessage("Filling dispenser @ " + TFM_Util.formatLocation(targetBlock.getLocation()));
|
||||
setDispenserContents(targetBlock, items_array);
|
||||
setDispenserContents(targetBlock, itemsArray);
|
||||
affected++;
|
||||
}
|
||||
}
|
||||
@ -98,11 +97,13 @@ public class Command_dispfill extends TFM_Command
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void setDispenserContents(Block targetBlock, ItemStack[] items)
|
||||
private static void setDispenserContents(final Block targetBlock, final ItemStack[] items)
|
||||
{
|
||||
Dispenser dispenser = (Dispenser) targetBlock.getState();
|
||||
Inventory disp_inv = dispenser.getInventory();
|
||||
disp_inv.clear();
|
||||
disp_inv.addItem(items);
|
||||
if (targetBlock.getType() == Material.DISPENSER)
|
||||
{
|
||||
final Inventory dispenserInv = ((Dispenser) targetBlock.getState()).getInventory();
|
||||
dispenserInv.clear();
|
||||
dispenserInv.addItem(items);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Ban;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
|
||||
@ -10,7 +9,6 @@ import me.StevenLawson.TotalFreedomMod.TFM_Player;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -52,8 +50,6 @@ public class Command_glist extends TFM_Command
|
||||
String username;
|
||||
final List<String> ips = new ArrayList<String>();
|
||||
|
||||
|
||||
|
||||
final Player player = getPlayer(args[1]);
|
||||
|
||||
if (player == null)
|
||||
@ -80,7 +76,7 @@ public class Command_glist extends TFM_Command
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Banning " + username + " and IPs: " + StringUtils.join(ips, ","), true);
|
||||
|
||||
Player target = server.getPlayerExact(username);
|
||||
Player target = getPlayer(username, true);
|
||||
if (target != null)
|
||||
{
|
||||
TFM_BanManager.addUuidBan(new TFM_Ban(TFM_Util.getUuid(target), target.getName()));
|
||||
|
@ -40,7 +40,7 @@ public class Command_op extends TFM_Command
|
||||
{
|
||||
if (TFM_AdminList.isSuperAdmin(sender) || senderIsConsole)
|
||||
{
|
||||
player = server.getOfflinePlayer(args[0]);
|
||||
player = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getOfflinePlayer(server, args[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ public class Command_ro extends TFM_Command
|
||||
{
|
||||
try
|
||||
{
|
||||
fromMaterial = Material.getMaterial(Integer.parseInt(materialName));
|
||||
fromMaterial = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getMaterial(Integer.parseInt(materialName));
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
@ -106,7 +106,6 @@ public class Command_ro extends TFM_Command
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Remove complete! " + affected + " blocks removed.", false);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ public class Command_saconfig extends TFM_Command
|
||||
return true;
|
||||
}
|
||||
|
||||
player = Bukkit.getOfflinePlayer(superadmin.getLastLoginName());
|
||||
player = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getOfflinePlayer(server, superadmin.getLastLoginName());
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Adding " + player.getName() + " to the superadmin list", true);
|
||||
@ -192,7 +192,6 @@ public class Command_saconfig extends TFM_Command
|
||||
|
||||
String targetName = args[1];
|
||||
|
||||
|
||||
final Player player = getPlayer(targetName);
|
||||
|
||||
if (player != null)
|
||||
@ -207,7 +206,7 @@ public class Command_saconfig extends TFM_Command
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Removing " + targetName + " from the superadmin list", true);
|
||||
TFM_AdminList.removeSuperadmin(Bukkit.getOfflinePlayer(targetName));
|
||||
TFM_AdminList.removeSuperadmin(me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getOfflinePlayer(server, targetName));
|
||||
|
||||
// Twitterbot
|
||||
if (TFM_ConfigEntry.TWITTERBOT_ENABLED.getBoolean())
|
||||
|
@ -1,6 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
@ -54,15 +55,15 @@ public class Command_setlever extends TFM_Command
|
||||
|
||||
final Location leverLocation = new Location(world, x, y, z);
|
||||
|
||||
final boolean leverOn = (args[4].trim().equalsIgnoreCase("on") || args[4].trim().equalsIgnoreCase("1")) ? true : false;
|
||||
final boolean leverOn = (args[4].trim().equalsIgnoreCase("on") || args[4].trim().equalsIgnoreCase("1"));
|
||||
|
||||
final Block targetBlock = leverLocation.getBlock();
|
||||
|
||||
if (targetBlock.getType() == Material.LEVER)
|
||||
{
|
||||
org.bukkit.material.Lever lever = new org.bukkit.material.Lever(Material.LEVER, targetBlock.getData());
|
||||
org.bukkit.material.Lever lever = TFM_DepreciationAggregator.makeLeverWithData(TFM_DepreciationAggregator.getData_Block(targetBlock));
|
||||
lever.setPowered(leverOn);
|
||||
targetBlock.setData(lever.getData());
|
||||
TFM_DepreciationAggregator.setData_Block(targetBlock, TFM_DepreciationAggregator.getData_MaterialData(lever));
|
||||
targetBlock.getState().update();
|
||||
}
|
||||
else
|
||||
|
@ -3,7 +3,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@ -75,7 +74,7 @@ public class Command_trail extends TFM_Command
|
||||
if (!fromBlock.equals(toBlock))
|
||||
{
|
||||
fromBlock.setType(Material.WOOL);
|
||||
fromBlock.setData((byte) RANDOM.nextInt(16));
|
||||
me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.setData_Block(fromBlock, (byte) RANDOM.nextInt(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public class Command_whitelist extends TFM_Command
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = server.getOfflinePlayer(search_name);
|
||||
player = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getOfflinePlayer(server, search_name);
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Adding " + player.getName() + " to the whitelist.", false);
|
||||
@ -114,7 +114,7 @@ public class Command_whitelist extends TFM_Command
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = server.getOfflinePlayer(search_name);
|
||||
player = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getOfflinePlayer(server, search_name);
|
||||
}
|
||||
|
||||
if (player.isWhitelisted())
|
||||
|
@ -11,7 +11,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "See who has a block and optionally smite", usage = "/<command> <item> [smite]", aliases = "wh")
|
||||
@CommandParameters(description = "See who has a block and optionally smite.", usage = "/<command> <item> [smite]", aliases = "wh")
|
||||
public class Command_whohas extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
@ -31,28 +31,29 @@ public class Command_whohas extends TFM_Command
|
||||
}
|
||||
}
|
||||
|
||||
Material material = Material.matchMaterial(args[0]);
|
||||
final String materialName = args[0];
|
||||
|
||||
Material material = Material.matchMaterial(materialName);
|
||||
if (material == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
material = Material.getMaterial(Integer.parseInt(args[0]));
|
||||
material = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getMaterial(Integer.parseInt(materialName));
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (material == null)
|
||||
{
|
||||
playerMsg("Invalid block: " + args[0], ChatColor.RED);
|
||||
playerMsg("Invalid block: " + materialName, ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
List<String> players = new ArrayList<String>();
|
||||
final List<String> players = new ArrayList<String>();
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
for (final Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (player.getInventory().contains(material))
|
||||
{
|
||||
|
@ -134,6 +134,11 @@ public abstract class TFM_Command
|
||||
}
|
||||
|
||||
public Player getPlayer(final String partialName)
|
||||
{
|
||||
return getPlayer(partialName, false);
|
||||
}
|
||||
|
||||
public Player getPlayer(final String partialName, final boolean exact)
|
||||
{
|
||||
if (partialName == null || partialName.isEmpty())
|
||||
{
|
||||
@ -143,7 +148,7 @@ public abstract class TFM_Command
|
||||
final Player[] players = server.getOnlinePlayers();
|
||||
|
||||
// Check exact matches first.
|
||||
for (Player player : players)
|
||||
for (final Player player : players)
|
||||
{
|
||||
if (partialName.equalsIgnoreCase(player.getName()))
|
||||
{
|
||||
@ -151,8 +156,13 @@ public abstract class TFM_Command
|
||||
}
|
||||
}
|
||||
|
||||
if (exact)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Then check partial matches in name.
|
||||
for (Player player : players)
|
||||
for (final Player player : players)
|
||||
{
|
||||
if (player.getName().toLowerCase().contains(partialName.toLowerCase()))
|
||||
{
|
||||
@ -161,7 +171,7 @@ public abstract class TFM_Command
|
||||
}
|
||||
|
||||
// Then check partial matches in display name.
|
||||
for (Player player : players)
|
||||
for (final Player player : players)
|
||||
{
|
||||
if (player.getDisplayName().toLowerCase().contains(partialName.toLowerCase()))
|
||||
{
|
||||
|
@ -2,8 +2,10 @@ package me.StevenLawson.TotalFreedomMod.Config;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.apache.commons.lang.exception.ExceptionUtils;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
@ -137,9 +139,17 @@ public class TFM_Config extends YamlConfiguration // BukkitLib @ https://github.
|
||||
final YamlConfiguration DEFAULT_CONFIG = new YamlConfiguration();
|
||||
try
|
||||
{
|
||||
DEFAULT_CONFIG.load(plugin.getResource(configFile.getName()));
|
||||
final InputStreamReader isr = new InputStreamReader(plugin.getResource(configFile.getName()));
|
||||
DEFAULT_CONFIG.load(isr);
|
||||
isr.close();
|
||||
}
|
||||
catch (Throwable ex)
|
||||
catch (IOException ex)
|
||||
{
|
||||
plugin.getLogger().severe("Could not load default configuration: " + configFile.getName());
|
||||
plugin.getLogger().severe(ExceptionUtils.getStackTrace(ex));
|
||||
return null;
|
||||
}
|
||||
catch (InvalidConfigurationException ex)
|
||||
{
|
||||
plugin.getLogger().severe("Could not load default configuration: " + configFile.getName());
|
||||
plugin.getLogger().severe(ExceptionUtils.getStackTrace(ex));
|
||||
|
@ -5,6 +5,7 @@ import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
@ -272,7 +273,9 @@ public class TFM_MainConfig
|
||||
try
|
||||
{
|
||||
defaults = new YamlConfiguration();
|
||||
defaults.load(defaultConfig);
|
||||
final InputStreamReader isr = new InputStreamReader(defaultConfig);
|
||||
defaults.load(isr);
|
||||
isr.close();
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
|
@ -17,7 +17,6 @@ import org.bukkit.Bukkit;
|
||||
|
||||
public class TFM_HTTPD_Manager
|
||||
{
|
||||
@Deprecated
|
||||
public static String MIME_DEFAULT_BINARY;
|
||||
//
|
||||
private static final Pattern EXT_REGEX;
|
||||
|
@ -158,7 +158,7 @@ public class TFM_EntityListener implements Listener
|
||||
if (TFM_ConfigEntry.ALLOW_EXPLOSIONS.getBoolean())
|
||||
{
|
||||
Projectile entity = event.getEntity();
|
||||
if (event.getEntityType() == EntityType.ARROW && entity.getShooter() instanceof Player)
|
||||
if (event.getEntityType() == EntityType.ARROW)
|
||||
{
|
||||
entity.getWorld().createExplosion(entity.getLocation(), 2F);
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ public class TFM_PlayerListener implements Listener
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
final Location location = player.getTargetBlock(null, 5).getLocation();
|
||||
final Location location = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getTargetBlock(player, null, 5).getLocation();
|
||||
final List<RollbackEntry> entries = TFM_RollbackManager.getEntriesAtLocation(location);
|
||||
|
||||
if (entries.isEmpty())
|
||||
@ -185,7 +185,7 @@ public class TFM_PlayerListener implements Listener
|
||||
|
||||
if (event.getAction().equals(Action.LEFT_CLICK_AIR))
|
||||
{
|
||||
targetBlock = player.getTargetBlock(null, 120);
|
||||
targetBlock = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getTargetBlock(player, null, 120);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -222,7 +222,7 @@ public class TFM_PlayerListener implements Listener
|
||||
Vector playerDirection = location.getDirection().normalize();
|
||||
|
||||
double distance = 150.0;
|
||||
Block targetBlock = player.getTargetBlock(null, Math.round((float) distance));
|
||||
Block targetBlock = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getTargetBlock(player, null, Math.round((float) distance));
|
||||
if (targetBlock != null)
|
||||
{
|
||||
distance = location.distance(targetBlock.getLocation());
|
||||
@ -275,7 +275,7 @@ public class TFM_PlayerListener implements Listener
|
||||
final int STRENGTH = 4;
|
||||
|
||||
// Clownfish
|
||||
if (event.getItem().getData().getData() == 2)
|
||||
if (TFM_DepreciationAggregator.getData_MaterialData(event.getItem().getData()) == 2)
|
||||
{
|
||||
if (TFM_AdminList.isSeniorAdmin(player, true) || TFM_AdminList.isTelnetAdmin(player, true))
|
||||
{
|
||||
|
@ -66,6 +66,7 @@ public class TFM_BanManager
|
||||
save();
|
||||
TFM_Log.info("Loaded " + ipBans.size() + " IP bans and " + uuidBans.size() + " UUID bans");
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
final TFM_UuidResolver resolver = new TFM_UuidResolver((List<String>) TFM_ConfigEntry.UNBANNABLE_USERNAMES.getList());
|
||||
|
||||
for (UUID uuid : resolver.call().values())
|
||||
|
@ -40,6 +40,7 @@ public class TFM_CommandBlocker
|
||||
return;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> _blockedCommands = (List<String>) TFM_ConfigEntry.BLOCKED_COMMANDS.getList();
|
||||
for (String rawEntry : _blockedCommands)
|
||||
{
|
||||
|
@ -0,0 +1,64 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.util.HashSet;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class TFM_DepreciationAggregator
|
||||
{
|
||||
public static Block getTargetBlock(LivingEntity entity, HashSet< Byte> transparent, int maxDistance)
|
||||
{
|
||||
return entity.getTargetBlock(transparent, maxDistance);
|
||||
}
|
||||
|
||||
public static OfflinePlayer getOfflinePlayer(Server server, String name)
|
||||
{
|
||||
return server.getOfflinePlayer(name);
|
||||
}
|
||||
|
||||
public static Material getMaterial(int id)
|
||||
{
|
||||
return Material.getMaterial(id);
|
||||
}
|
||||
|
||||
public static byte getData_MaterialData(MaterialData md)
|
||||
{
|
||||
return md.getData();
|
||||
}
|
||||
|
||||
public static void setData_MaterialData(MaterialData md, byte data)
|
||||
{
|
||||
md.setData(data);
|
||||
}
|
||||
|
||||
public static byte getData_Block(Block block)
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
@ -209,7 +209,7 @@ public class TFM_RollbackManager
|
||||
public final short y;
|
||||
public final int z;
|
||||
public final byte data;
|
||||
public final short blockId;
|
||||
public final Material blockMaterial;
|
||||
private final boolean isBreak;
|
||||
|
||||
private RollbackEntry(String author, Block block, EntryType entryType)
|
||||
@ -224,14 +224,14 @@ public class TFM_RollbackManager
|
||||
|
||||
if (entryType == EntryType.BLOCK_BREAK)
|
||||
{
|
||||
this.blockId = (short) block.getTypeId();
|
||||
this.data = block.getData();
|
||||
this.blockMaterial = block.getType();
|
||||
this.data = TFM_DepreciationAggregator.getData_Block(block);
|
||||
this.isBreak = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.blockId = (short) block.getTypeId();
|
||||
this.data = block.getData();
|
||||
this.blockMaterial = block.getType();
|
||||
this.data = TFM_DepreciationAggregator.getData_Block(block);
|
||||
this.isBreak = false;
|
||||
}
|
||||
}
|
||||
@ -251,7 +251,7 @@ public class TFM_RollbackManager
|
||||
|
||||
public Material getMaterial()
|
||||
{
|
||||
return Material.getMaterial(blockId);
|
||||
return blockMaterial;
|
||||
}
|
||||
|
||||
public EntryType getType()
|
||||
@ -265,7 +265,7 @@ public class TFM_RollbackManager
|
||||
if (isBreak)
|
||||
{
|
||||
block.setType(getMaterial());
|
||||
block.setData(data);
|
||||
TFM_DepreciationAggregator.setData_Block(block, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -284,7 +284,7 @@ public class TFM_RollbackManager
|
||||
else
|
||||
{
|
||||
block.setType(getMaterial());
|
||||
block.setData(data);
|
||||
TFM_DepreciationAggregator.setData_Block(block, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -98,6 +98,7 @@ public class TFM_ServiceChecker
|
||||
final Iterator serviceIt = ((JSONObject) status.next()).entrySet().iterator();
|
||||
while (serviceIt.hasNext())
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
final Entry<String, String> pair = (Entry<String, String>) serviceIt.next();
|
||||
|
||||
if ("lastcheck".equals(pair.getKey()))
|
||||
|
@ -73,11 +73,11 @@ public class TFM_Util
|
||||
{
|
||||
try
|
||||
{
|
||||
if (type.getName() != null)
|
||||
if (TFM_DepreciationAggregator.getName_EntityType(type) != null)
|
||||
{
|
||||
if (Creature.class.isAssignableFrom(type.getEntityClass()))
|
||||
{
|
||||
mobtypes.put(type.getName().toLowerCase(), type);
|
||||
mobtypes.put(TFM_DepreciationAggregator.getName_EntityType(type).toLowerCase(), type);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -527,7 +527,6 @@ public class TFM_Util
|
||||
|
||||
TFM_Util.bcastMsg(ChatColor.RED + player.getName() + " has been banned for 1 minute.");
|
||||
|
||||
|
||||
TFM_BanManager.addIpBan(new TFM_Ban(ip, player.getName(), "AutoEject", expires, kickMessage));
|
||||
TFM_BanManager.addUuidBan(new TFM_Ban(TFM_Util.getUuid(player), player.getName(), "AutoEject", expires, kickMessage));
|
||||
player.kickPlayer(kickMessage);
|
||||
@ -542,7 +541,6 @@ public class TFM_Util
|
||||
|
||||
TFM_Util.bcastMsg(ChatColor.RED + player.getName() + " has been banned for 3 minutes.");
|
||||
|
||||
|
||||
TFM_BanManager.addIpBan(new TFM_Ban(ip, player.getName(), "AutoEject", expires, kickMessage));
|
||||
TFM_BanManager.addUuidBan(new TFM_Ban(TFM_Util.getUuid(player), player.getName(), "AutoEject", expires, kickMessage));
|
||||
player.kickPlayer(kickMessage);
|
||||
@ -963,7 +961,6 @@ public class TFM_Util
|
||||
field.setAccessible(true);
|
||||
return (T) field.get(from);
|
||||
|
||||
|
||||
}
|
||||
catch (NoSuchFieldException ex)
|
||||
{
|
||||
@ -1013,7 +1010,6 @@ public class TFM_Util
|
||||
String packageName = Bukkit.getServer().getClass().getPackage().getName();
|
||||
return packageName.substring(packageName.lastIndexOf('.') + 1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static class TFM_EntityWiper
|
||||
|
@ -22,6 +22,7 @@ import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class CleanroomBlockPopulator extends BlockPopulator
|
||||
{
|
||||
byte[] layerDataValues;
|
||||
|
@ -30,6 +30,7 @@ import org.bukkit.World;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class CleanroomChunkGenerator extends ChunkGenerator
|
||||
{
|
||||
private static final Logger log = Bukkit.getLogger();
|
||||
|
Loading…
Reference in New Issue
Block a user