Skip to content

Commit

Permalink
Version up
Browse files Browse the repository at this point in the history
Removed warnings from various deprecated classes.
Closed up potential resource leaks.
  • Loading branch information
tastybento committed Apr 24, 2016
1 parent 9eb26b3 commit 2c34954
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 31 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<server.jars>${project.basedir}/lib</server.jars>
</properties>

<!--
<distributionManagement>
<repository>
<id>bintray-tastybento-maven-repo</id>
<name>tastybento-askyblock</name>
<url>https://api.bintray.com/maven/tastybento/maven-repo/askyblock/;publish=1</url>
</repository>
</distributionManagement>

-->
<build>
<defaultGoal>clean package install</defaultGoal>
<finalName>askyblock</finalName>
Expand Down Expand Up @@ -162,5 +162,5 @@
<url>http://maven.sk89q.com/repo/</url>
</repository>
</repositories>
<version>3.0.0.4</version>
<version>3.0.0.5</version>
</project>
1 change: 1 addition & 0 deletions src/com/wasteofplastic/askyblock/DeleteIslandChunk.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ public DeleteIslandChunk(final ASkyBlock plugin, final Island island) {
plugin.getLogger().info("Island delete: There are " + chunksToClear.size() + " chunks that need to be cleared up.");
plugin.getLogger().info("Clean rate is " + Settings.cleanRate + " chunks per second. Should take ~" + Math.round(chunksToClear.size()/Settings.cleanRate) + "s");
new BukkitRunnable() {
@SuppressWarnings("deprecation")
@Override
public void run() {
Iterator<Pair> it = chunksToClear.iterator();
Expand Down
2 changes: 0 additions & 2 deletions src/com/wasteofplastic/askyblock/InventorySave.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@
public class InventorySave {
private static InventorySave instance = new InventorySave(ASkyBlock.getPlugin());
private HashMap<UUID, InventoryStore> inventories;
private ASkyBlock plugin;

/**
* Saves the inventory of a player
*/
public InventorySave(ASkyBlock plugin) {
this.plugin = plugin;
inventories = new HashMap<UUID, InventoryStore>();
}

Expand Down
10 changes: 3 additions & 7 deletions src/com/wasteofplastic/askyblock/Locale.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package com.wasteofplastic.askyblock;

import java.io.File;
import java.io.InputStream;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
Expand Down Expand Up @@ -642,9 +641,7 @@ public void reloadLocale(String localeName) {
locale = YamlConfiguration.loadConfiguration(localeFile);
} else {
// Look for defaults in the jar
InputStream defLocaleStream = plugin.getResource("locale/" + localeName + ".yml");
if (defLocaleStream != null) {
//plugin.getLogger().info("DEBUG: Saving from jar");
if (plugin.getResource("locale/" + localeName + ".yml") != null) {
plugin.saveResource("locale/" + localeName + ".yml", true);
localeFile = new File(plugin.getDataFolder() + File.separator + "locale", localeName + ".yml");
locale = YamlConfiguration.loadConfiguration(localeFile);
Expand All @@ -655,9 +652,8 @@ public void reloadLocale(String localeName) {
if (localeFile.exists()) {
locale = YamlConfiguration.loadConfiguration(localeFile);
} else {
// Look for defaults in the jar
defLocaleStream = plugin.getResource("locale/locale.yml");
if (defLocaleStream != null) {
// Look for defaults in the jar
if (plugin.getResource("locale/locale.yml") != null) {
plugin.saveResource("locale/locale.yml", true);
localeFile = new File(plugin.getDataFolder() + File.separator + "locale", "locale.yml");
locale = YamlConfiguration.loadConfiguration(localeFile);
Expand Down
2 changes: 0 additions & 2 deletions src/com/wasteofplastic/askyblock/SafeBoat.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,11 @@
public class SafeBoat implements Listener {
// Flags to indicate if a player has exited a boat recently or not
private static HashMap<UUID, Entity> exitedBoat = new HashMap<UUID, Entity>();
private final ASkyBlock plugin;
// Stores players that should be ignored because they are being teleported away from
// a locked islands
private static Set<UUID> ignoreList = new HashSet<UUID>();

public SafeBoat(ASkyBlock aSkyBlock) {
plugin = aSkyBlock;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/com/wasteofplastic/askyblock/SafeSpotTeleport.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ public SafeSpotTeleport(final ASkyBlock plugin, final Entity entity, final Locat
//plugin.getLogger().info("DEBUG:world height = " + worldHeight);
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() {

@Override
@SuppressWarnings("deprecation")
@Override
public void run() {
// Find a safe spot, defined as a solid block, with 2 air spaces above it
//long time = System.nanoTime();
Expand All @@ -134,7 +135,6 @@ public void run() {
Vector portalPart = null;
double distance = 0D;
double safeDistance = 0D;
search:
for (ChunkSnapshot chunk: finalChunk) {
for (x = 0; x< 16; x++) {
for (z = 0; z < 16; z++) {
Expand Down
1 change: 0 additions & 1 deletion src/com/wasteofplastic/askyblock/TinyDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.io.PrintWriter;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.TreeMap;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;

Expand Down
8 changes: 3 additions & 5 deletions src/com/wasteofplastic/askyblock/commands/Challenges.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
Expand Down Expand Up @@ -1865,12 +1864,11 @@ public void reloadChallengeConfig() {
challengeFile = YamlConfiguration.loadConfiguration(challengeConfigFile);

// Look for defaults in the jar

InputStream defConfigStream = plugin.getResource("challenges.yml");
if (defConfigStream != null) {
/*
if (plugin.getResource("challenges.yml") != null) {
YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
challengeFile.setDefaults(defConfig);
}
}*/
Settings.challengeList = getChallengeConfig().getConfigurationSection("challenges.challengeList").getKeys(false);
Settings.challengeLevels = Arrays.asList(getChallengeConfig().getString("challenges.levels","").split(" "));
Settings.freeLevels = Arrays.asList(getChallengeConfig().getString("challenges.freelevels","").split(" "));
Expand Down
3 changes: 2 additions & 1 deletion src/com/wasteofplastic/askyblock/commands/IslandCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public IslandCmd(ASkyBlock aSkyBlock) {
* Loads schematics from the config.yml file. If the default
* island is not included, it will be made up
*/
@SuppressWarnings("deprecation")
public void loadSchematics() {
// Check if there is a schematic folder and make it if it does not exist
File schematicFolder = new File(plugin.getDataFolder(), "schematics");
Expand Down Expand Up @@ -2549,7 +2550,7 @@ public void run() {
} else {
plugin.getMessages().setMessage(targetPlayerUUID, ChatColor.GREEN + plugin.myLocale(targetPlayerUUID).banLifted.replace("[name]", player.getDisplayName()));
}
OfflinePlayer offlineTarget = plugin.getServer().getOfflinePlayer(targetPlayerUUID);
//OfflinePlayer offlineTarget = plugin.getServer().getOfflinePlayer(targetPlayerUUID);
// Player
player.sendMessage(ChatColor.GREEN + plugin.myLocale(player.getUniqueId()).banLiftedSuccess.replace("[name]", split[1]));
// Console
Expand Down
1 change: 1 addition & 0 deletions src/com/wasteofplastic/askyblock/listeners/AcidEffect.java
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ public void onPlayerInteract(final PlayerInteractEvent e) {
}
if (plugin.getGrid().playerIsOnIsland(e.getPlayer())) {
boolean otherOb = false;
@SuppressWarnings("deprecation")
ItemStack inHand = e.getPlayer().getItemInHand();
if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK) && inHand.getType().equals(Material.BUCKET)
&& e.getClickedBlock().getType().equals(Material.OBSIDIAN)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void onEntityPortal(EntityPortalEvent event) {
if (plugin.getServer().getWorld(Settings.worldName + "_the_end") != null) {
// The end exists
Location end_place = plugin.getServer().getWorld(Settings.worldName + "_the_end").getSpawnLocation();
boolean result = event.getEntity().teleport(end_place);
event.getEntity().teleport(end_place);
//plugin.getLogger().info("DEBUG: Result " + result + " teleported " + event.getEntityType() + " to " + end_place);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/com/wasteofplastic/askyblock/listeners/WorldLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
import com.wasteofplastic.askyblock.Settings;

public class WorldLoader implements Listener {
private ASkyBlock plugin;
//private ASkyBlock plugin;
private boolean worldLoaded = false;

/**
* Class to force world loading before plugins.
* @param aSkyBlock
*/
public WorldLoader(ASkyBlock aSkyBlock) {
this.plugin = aSkyBlock;
//this.plugin = aSkyBlock;
}

@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public boolean isPotion(ItemStack item) {
return false;
}

@SuppressWarnings("deprecation")
@Override
public ItemStack setPotion(Material itemMaterial, Tag itemTags,
ItemStack chestItem) {
Expand Down
1 change: 1 addition & 0 deletions src/com/wasteofplastic/askyblock/panels/MiniShopItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ public void setExtra(String extra) {
* The item stack
* @return A string with the name of the item.
*/
@SuppressWarnings("deprecation")
private static String getDataName(ItemStack item) {
Material mat = item.getType();
// Find out durability, which indicates additional information on the
Expand Down
12 changes: 7 additions & 5 deletions src/com/wasteofplastic/askyblock/schematics/Schematic.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ public class Schematic {
private Vector welcomeSign;
private Vector topGrass;
private Vector playerSpawn;
private Material playerSpawnBlock;
//private Material playerSpawnBlock;
private NMSAbstraction nms;
private Set<Integer> attachable = new HashSet<Integer>();
private Map<String, Art> paintingList = new HashMap<String, Art>();
private Map<Byte, BlockFace> facingList = new HashMap<Byte, BlockFace>();
private Map<Byte, Rotation> rotationList = new HashMap<Byte, Rotation>();
private List<IslandBlock> islandBlocks;
private boolean pasteAir;
//private boolean pasteAir;
private int durability;
private int levelHandicap;

Expand Down Expand Up @@ -151,7 +151,7 @@ public Schematic(ASkyBlock plugin) {
welcomeSign = null;
topGrass = null;
playerSpawn = null;
playerSpawnBlock = null;
//playerSpawnBlock = null;
partnerName = "";
}

Expand Down Expand Up @@ -182,7 +182,7 @@ public Schematic(ASkyBlock plugin, File file) throws IOException {
welcomeSign = null;
topGrass = null;
playerSpawn = null;
playerSpawnBlock = null;
//playerSpawnBlock = null;
partnerName = "";

attachable.add(Material.STONE_BUTTON.getId());
Expand Down Expand Up @@ -284,6 +284,7 @@ public Schematic(ASkyBlock plugin, File file) throws IOException {

CompoundTag schematicTag = (CompoundTag) nbtStream.readTag();
nbtStream.close();
stream.close();
if (!schematicTag.getName().equals("Schematic")) {
throw new IllegalArgumentException("Tag \"Schematic\" does not exist or is not first");
}
Expand Down Expand Up @@ -1046,7 +1047,7 @@ public void prePasteSchematic(short[] blocks, byte[] data) {
//plugin.getLogger().info("DEBUG: torch = " + Material.TORCH.getId());
//plugin.getLogger().info("DEBUG: non attachable");
//plugin.getLogger().info("DEBUG: bedrock y = " + bedrock.getBlockY());
int count = 0;
//int count = 0;
for (int x = 0; x < width; ++x) {
for (int y = 0; y < height; ++y) {
for (int z = 0; z < length; ++z) {
Expand Down Expand Up @@ -1512,6 +1513,7 @@ public Location getPlayerSpawn(Location pasteLocation) {
* @param playerSpawnBlock the playerSpawnBlock to set
* @return true if block is found otherwise false
*/
@SuppressWarnings("deprecation")
public boolean setPlayerSpawnBlock(Material playerSpawnBlock) {
if (bedrock == null) {
return false;
Expand Down

0 comments on commit 2c34954

Please sign in to comment.