forked from Upstream/mmocore
fixed an npe with friend list
This commit is contained in:
parent
8b85248918
commit
8c95245ffb
7
pom.xml
7
pom.xml
@ -102,12 +102,6 @@
|
||||
<url>https://papermc.io/repo/repository/maven-public/</url>
|
||||
</repository>
|
||||
|
||||
<!-- holographic displays -->
|
||||
<repository>
|
||||
<id>codemc-repo</id>
|
||||
<url>https://repo.codemc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
@ -176,7 +170,6 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Local repo -->
|
||||
<dependency>
|
||||
<groupId>com.bekvon.bukkit.residence</groupId>
|
||||
<artifactId>Residence</artifactId>
|
||||
|
@ -236,75 +236,13 @@ public class EditableFriendList extends EditableInventory {
|
||||
});
|
||||
}
|
||||
|
||||
if (item.getFunction().equals("friend") && event.getAction() == InventoryAction.PICKUP_HALF)
|
||||
InventoryManager.FRIEND_REMOVAL.newInventory(playerData,
|
||||
Bukkit.getOfflinePlayer(UUID.fromString(NBTItem.get(event.getCurrentItem()).getString("uuid"))), this).open();
|
||||
}
|
||||
}
|
||||
if (item.getFunction().equals("friend") && event.getAction() == InventoryAction.PICKUP_HALF) {
|
||||
String tag = NBTItem.get(event.getCurrentItem()).getString("uuid");
|
||||
if (tag == null || tag.isEmpty())
|
||||
return;
|
||||
|
||||
// private int page;
|
||||
// private ItemStack next, prev, newreq;
|
||||
//
|
||||
// private int[] slots = { 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23,
|
||||
// 24, 25, 28, 29, 30, 31, 32, 33, 34 };
|
||||
//
|
||||
// public EditableFriendList(Player player) {
|
||||
// this(player, 1);
|
||||
// }
|
||||
//
|
||||
// public EditableFriendList(Player player, int page) {
|
||||
// super(player);
|
||||
// this.page = page;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Inventory getInventory() {
|
||||
// Inventory inv = Bukkit.createInventory(this, 54, "Friends");
|
||||
//
|
||||
// int n = 0;
|
||||
// for (int j = 21 * (page - 1); j < Math.min(21 * page,
|
||||
// playerData.getFriends().size()); j++) {
|
||||
//
|
||||
// /*
|
||||
// * if the player is not found, delete it from the friend list.
|
||||
// */
|
||||
// UUID uuid = playerData.getFriends().get(j);
|
||||
// OfflinePlayer offline = Bukkit.getOfflinePlayer(uuid);
|
||||
// if (offline == null || offline.getName() == null) {
|
||||
// playerData.removeFriend(uuid);
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// PlayerDataManager data;
|
||||
// ItemStack item = offline.isOnline() ? new
|
||||
// ConfigItem("ONLINE_FRIEND").addPlaceholders("name", offline.getName(),
|
||||
// "online_since", "" + new DelayFormat(2).format(System.currentTimeMillis()
|
||||
// - (data = PlayerDataManager.get(offline)).getLastLogin()), "class",
|
||||
// data.getProfess().getName(), "level", "" + data.getLevel()).build() : new
|
||||
// ConfigItem("OFFLINE_FRIEND").addPlaceholders("name", offline.getName(),
|
||||
// "last_seen", new DelayFormat(2).format(System.currentTimeMillis() -
|
||||
// offline.getLastPlayed())).build();
|
||||
//
|
||||
// SkullMeta meta = (SkullMeta) item.getItemMeta();
|
||||
// meta.setOwningPlayer(offline);
|
||||
// item.setItemMeta(meta);
|
||||
//
|
||||
// inv.setItem(slots[n++], NBTItem.get(item).add(new ItemTag("uuid",
|
||||
// offline.getUniqueId().toString())).toItem());
|
||||
// }
|
||||
//
|
||||
// if (page > 1)
|
||||
// inv.setItem(18, prev = new ConfigItem("PREVIOUS_PAGE").build());
|
||||
//
|
||||
// if (playerData.getFriends().size() > 21 * page)
|
||||
// inv.setItem(26, next = new ConfigItem("NEXT_PAGE").build());
|
||||
//
|
||||
// ItemStack fill = new ConfigItem("NO_FRIEND").build();
|
||||
// while (n < 21 * page)
|
||||
// inv.setItem(slots[n++], fill);
|
||||
//
|
||||
// inv.setItem(49, newreq = new ConfigItem("NEW_FRIEND_REQUEST").build());
|
||||
//
|
||||
// return inv;
|
||||
// }
|
||||
InventoryManager.FRIEND_REMOVAL.newInventory(playerData, Bukkit.getOfflinePlayer(UUID.fromString(tag)), this).open();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user