mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-21 12:32:23 +00:00
Fix #1325 Null Pointer Exception from broken mailbox
This commit is contained in:
1 parent
c0a22f4a28
commit
e9809238de
15 files changed
+51
-43
No files matched your search
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.mail;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.File;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
@@ -47,7 +48,7 @@ public class PostRegistry implements IPostRegistry {
|
||||
*/
|
||||
@Override
|
||||
public boolean isValidPOBox(World world, IMailAddress address) {
|
||||
return address.isPlayer() && address.getName().matches("^[a-zA-Z0-9]+$");
|
||||
return address.getType() == EnumAddressee.PLAYER && address.getName().matches("^[a-zA-Z0-9]+$");
|
||||
}
|
||||
|
||||
public static POBox getPOBox(World world, IMailAddress address) {
|
||||
@@ -88,7 +89,7 @@ public class PostRegistry implements IPostRegistry {
|
||||
*/
|
||||
@Override
|
||||
public boolean isValidTradeAddress(World world, IMailAddress address) {
|
||||
return address != null && address.isTrader() && address.getName().matches("^[a-zA-Z0-9]+$");
|
||||
return address != null && address.getType() == EnumAddressee.TRADER && address.getName().matches("^[a-zA-Z0-9]+$");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -173,13 +174,14 @@ public class PostRegistry implements IPostRegistry {
|
||||
return office;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IMailAddress getMailAddress(GameProfile gameProfile) {
|
||||
public IMailAddress getMailAddress(@Nonnull GameProfile gameProfile) {
|
||||
return new MailAddress(gameProfile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMailAddress getMailAddress(String traderName) {
|
||||
public IMailAddress getMailAddress(@Nonnull String traderName) {
|
||||
return new MailAddress(traderName);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user