Skip to content

Commit

Permalink
Merge pull request #17 from Aleksey-Terzi/master
Browse files Browse the repository at this point in the history
Update dependencies to 1.11-spigot and avoid warnings
  • Loading branch information
ProgrammerDan authored Jun 8, 2017
2 parents dcb82ce + 882412d commit 7d79634
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 16 deletions.
13 changes: 6 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
<groupId>com.untamedears</groupId>
<artifactId>JukeAlert</artifactId>
<packaging>jar</packaging>
<version>1.4.13</version>
<version>1.5.0</version>
<name>JukeAlert</name>
<url>https://github.com/DevotedMC/JukeAlert/</url>


<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
Expand Down Expand Up @@ -39,19 +38,19 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.10.2-R0.1-SNAPSHOT</version>
<version>1.11-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>vg.civcraft.mc.namelayer</groupId>
<artifactId>NameLayer</artifactId>
<version>2.9.08</version>
<version>2.10.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>vg.civcraft.mc.citadel</groupId>
<artifactId>Citadel</artifactId>
<version>3.7.02</version>
<version>3.8.00</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -63,7 +62,7 @@
<dependency>
<groupId>com.untamedears</groupId>
<artifactId>ItemExchange</artifactId>
<version>1.1.1</version>
<version>1.2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -75,7 +74,7 @@
<dependency>
<groupId>vg.civcraft.mc.civmodcore</groupId>
<artifactId>CivModCore</artifactId>
<version>1.5.09</version>
<version>1.5.11</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/com/untamedears/JukeAlert/DeprecatedMethods.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.untamedears.JukeAlert;

import org.bukkit.Material;

@SuppressWarnings("deprecation")
public class DeprecatedMethods {
public static int getMaterialId(Material material) {
return material.getId();
}

public static Material getMaterialById(int id) {
return Material.getMaterial(id);
}
}
1 change: 1 addition & 0 deletions src/main/java/com/untamedears/JukeAlert/JukeAlert.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ private void registerEvents() {
}
}

@SuppressWarnings("unchecked")
private void registerNameLayerPermissions() {

LinkedList<PlayerType> memberAndAbove = new LinkedList<PlayerType>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.bukkit.Material;
import org.bukkit.entity.Player;

import com.untamedears.JukeAlert.DeprecatedMethods;
import com.untamedears.JukeAlert.JukeAlert;
import com.untamedears.JukeAlert.model.SnitchAction;
import com.untamedears.JukeAlert.storage.JukeAlertLogger;
Expand Down Expand Up @@ -91,7 +92,7 @@ public void run() {
for (SnitchAction entry: info) {
Material mat = entry.getMaterial();
if (mat != null && !mat.equals(Material.AIR)) {
int mat_id = mat.getId();
int mat_id = DeprecatedMethods.getMaterialId(mat);
String mat_name = mat.name();
if (mat_name != null && !mat_name.isEmpty() && !materials.containsKey(mat_id)) {
materials.put(mat_id, mat_name);
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/com/untamedears/JukeAlert/model/Snitch.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import com.untamedears.JukeAlert.JukeAlert;
import com.untamedears.JukeAlert.manager.ConfigManager;

public class Snitch implements QTBox, Comparable {
public class Snitch implements QTBox, Comparable<Snitch> {

private int snitchId;

Expand Down Expand Up @@ -106,15 +106,14 @@ public int qtZMax() {

// Interface Comparable
@Override
public int compareTo(Object o) {
public int compareTo(Snitch other) {

// This assumes that only a single snitch can exist at a given (x, y, z)
// Compare centers
// TODO: Deal with volume changes when applicable
// 1. Test X relationship
// 2. Test Z relationship
// 3. Test Y relationship
Snitch other = (Snitch) o;
int tx = this.getX();
int ty = this.getY();
int tz = this.getZ();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.bukkit.entity.Player;
import org.bukkit.entity.Vehicle;

import com.untamedears.JukeAlert.DeprecatedMethods;
import com.untamedears.JukeAlert.JukeAlert;
import com.untamedears.JukeAlert.chat.ChatFiller;
import com.untamedears.JukeAlert.chat.SendSnitchList;
Expand Down Expand Up @@ -1424,7 +1425,7 @@ public List<SnitchAction> getAllSnitchLogs(Snitch snitch) {
int x = rs.getInt("snitch_logged_x");
int y = rs.getInt("snitch_logged_y");
int z = rs.getInt("snitch_logged_z");
Material mat = Material.getMaterial(rs.getInt("snitch_logged_materialid"));
Material mat = DeprecatedMethods.getMaterialById(rs.getInt("snitch_logged_materialid"));
log.add(new SnitchAction(snitchActionId, snitch.getId(), date, action, initiatedUser, victim,
x, y, z, mat));
}
Expand Down Expand Up @@ -1483,13 +1484,13 @@ public static String createInfoString(SnitchAction entry, boolean censorLocation
actionText = timestamp;
break;
case 2:
actionText = String.format("%d %s", material.getId(), coords);
actionText = String.format("%d %s", DeprecatedMethods.getMaterialId(material), coords);
break;
case 3:
actionText = victim;
// Add location data (if possible)
if (material != null && action != LoggedAction.KILL) {
int victim_id = material.getId();
int victim_id = DeprecatedMethods.getMaterialId(material);
if (victim_id >= 0) {
actionText = String.format("%d %s", victim_id, coords);
}
Expand Down Expand Up @@ -1520,7 +1521,7 @@ public SnitchAction resultToSnitchAction(ResultSet set, boolean isGroup) {
int x = set.getInt("snitch_logged_x");
int y = set.getInt("snitch_logged_y");
int z = set.getInt("snitch_logged_z");
Material mat = Material.getMaterial(set.getInt("snitch_logged_materialid"));
Material mat = DeprecatedMethods.getMaterialById(set.getInt("snitch_logged_materialid"));
if (victim != null && !victim.isEmpty()) {
Material victim_material = Material.matchMaterial(victim);
if (mat.equals(Material.AIR) && victim_material != null && action != LoggedAction.KILL) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.bukkit.Location;
import org.bukkit.Material;

import com.untamedears.JukeAlert.DeprecatedMethods;
import com.untamedears.JukeAlert.model.LoggedAction;
import com.untamedears.JukeAlert.model.Snitch;

Expand Down Expand Up @@ -96,7 +97,7 @@ public void addSet(Snitch snitch, Material material, Location loc, Date date, Lo
currentSet.setNull(8, java.sql.Types.INTEGER);
}
if (material != null) {
currentSet.setShort(9, (short) material.getId());
currentSet.setShort(9, (short)DeprecatedMethods.getMaterialId(material));
} else {
currentSet.setNull(9, java.sql.Types.SMALLINT);
}
Expand Down

0 comments on commit 7d79634

Please sign in to comment.