From ed452b285617b7ac842841974245f559fd46fa56 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 10 Nov 2019 23:55:21 +0100 Subject: [PATCH] Fixing Material not found --- .../de/steamwar/core/events/PlayerJoinedEvent.java | 2 +- .../src/de/steamwar/inventory/SWItem.java | 14 +++++++++----- .../src/de/steamwar/sql/SteamwarUser.java | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/core/events/PlayerJoinedEvent.java b/SpigotCore_Main/src/de/steamwar/core/events/PlayerJoinedEvent.java index 3461df9..edae08e 100644 --- a/SpigotCore_Main/src/de/steamwar/core/events/PlayerJoinedEvent.java +++ b/SpigotCore_Main/src/de/steamwar/core/events/PlayerJoinedEvent.java @@ -12,7 +12,7 @@ public class PlayerJoinedEvent implements Listener{ @EventHandler private void onJoin(PlayerJoinEvent event) { - Player player = event.getPlayer(); + Player player = event.getPlayer(); SteamwarUser user = SteamwarUser.get(player.getUniqueId()); switch(user.getUserGroup()){ diff --git a/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java b/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java index bcfdeac..d956c00 100644 --- a/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java +++ b/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java @@ -30,11 +30,15 @@ public class SWItem { } public static Material getMaterial(String material){ - switch(Core.getVersion()){ - case 14: - return SWItem_v14.getMaterial(material); - default: - return SWItem_v12.getMaterial(material); + try{ + switch(Core.getVersion()){ + case 14: + return SWItem_v14.getMaterial(material); + default: + return SWItem_v12.getMaterial(material); + } + }catch(IllegalArgumentException e){ + return Material.STONE; } } diff --git a/SpigotCore_Main/src/de/steamwar/sql/SteamwarUser.java b/SpigotCore_Main/src/de/steamwar/sql/SteamwarUser.java index 9e8606a..55a1df2 100644 --- a/SpigotCore_Main/src/de/steamwar/sql/SteamwarUser.java +++ b/SpigotCore_Main/src/de/steamwar/sql/SteamwarUser.java @@ -32,7 +32,7 @@ public class SteamwarUser { id = rs.getInt("id"); uuid = java.util.UUID.fromString(rs.getString("UUID")); userName = rs.getString("UserName"); - userGroup = de.steamwar.sql.UserGroup.valueOf(rs.getString("UserGroup")); + userGroup = UserGroup.valueOf(rs.getString("UserGroup")); team = rs.getInt("Team"); byUUID.put(uuid, this);