-
Notifications
You must be signed in to change notification settings - Fork 14
Stability update of v2.6.1 #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.6.1
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if a null check here is necessary, but it doesn't change much either way. If this is going to stay, line 106 needs to be changed to use the set target variable. No point retrieving the offline player twice... |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a huge fan of generic exception catches, especially in a for loop, but as long as it runs I think this is fine |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like these changes, as long as they've been tested and work Great comments! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -702,7 +702,7 @@ public void setShopSettings(Map<ShopSettingKeys, ObjectHolder<?>> newSettings) { | |
| * @return list of ShopUsers. | ||
| */ | ||
| public List<ShopUser> getUsers(ShopRole... roles) { | ||
| return getUsersExcluding(Collections.emptyList(), roles); | ||
| return getUsersUUID(roles).stream().map((uuid) -> new ShopUser(uuid, ShopRole.MANAGER)).collect(Collectors.toList()); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. God it's been awhile... Pretty sure Users and Managers are separate lists and players shouldn't exist in both lists, hence the empty list. I guess double check that and correct me if I'm wrong.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll just correct myself; Users refers to any users from Members, Managers, and Owner. Your changes seem to force all users into Managers, which would be a problem. I'm also not a fan of iterating through the list twice if we need an excluded list. Would prefer this method is left as it was and your changes be focused on fixing the getUsersExcluding method (Which seems to be recursive with what I can see here) |
||
| } | ||
|
|
||
| /** | ||
|
|
@@ -713,13 +713,7 @@ public List<ShopUser> getUsers(ShopRole... roles) { | |
| * @return list of ShopUsers. | ||
| */ | ||
| public List<ShopUser> getUsersExcluding(List<UUID> excludedPlayers, ShopRole... roles) { | ||
| List<ShopUser> users = new ArrayList<>(); | ||
| getUsers(roles).forEach(user -> { | ||
| if (!excludedPlayers.contains(user.getUUID())) | ||
| users.add(user); | ||
| }); | ||
|
|
||
| return users; | ||
| return getUsers(roles).stream().filter((shopUser) -> !excludedPlayers.contains(shopUser.getUUID())).collect(Collectors.toList()); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See comment on 705 |
||
| } | ||
|
|
||
| /** | ||
|
|
@@ -936,7 +930,7 @@ public void fixSide(ShopItemSide side) { | |
|
|
||
| Set<Material> matSet = new HashSet<>(); | ||
|
|
||
| ogItems.forEach((item) -> matSet.add(item.getItemStack().getType())); | ||
| ogItems.stream().filter(shopItemStack -> shopItemStack.getItemStack() != null).forEach((item) -> matSet.add(item.getItemStack().getType())); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure how filter processes, if it processes the entire list before forEach then I don't like this at it would cause us to iterate the list twice. If it checks the filter before running the forEach on each item, then this is a good change. |
||
|
|
||
|
|
||
| if (ogItems.size() > 1 && ogItems.size() != matSet.size()) { | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't have time right now to understand these changes, but a couple things to double check.
|
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See line comments |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,6 +38,7 @@ | |
| import org.shanerx.tradeshop.shop.Shop; | ||
| import org.shanerx.tradeshop.shop.ShopType; | ||
| import org.shanerx.tradeshop.utils.Utils; | ||
| import org.shanerx.tradeshop.utils.debug.DebugLevels; | ||
|
|
||
| @SuppressWarnings("unused") | ||
| public class ShopCreateListener extends Utils implements Listener { | ||
|
|
@@ -55,10 +56,15 @@ public void onSignChange(SignChangeEvent event) { | |
| shopSign.setLine(3, event.getLine(3)); | ||
|
|
||
| if (!ShopType.isShop(shopSign)) { | ||
| TradeShop.getPlugin().getDebugger().log("ShopType.isShop() returned false for sign: " + event.getLine(0), DebugLevels.SHOP_CREATION); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe I omitted the debug logging on this as it'll cause an excessive amount of spam and unnecessary strain. This should be removed, if we need debugging for specific check conditions, then that can probably be added in |
||
| return; | ||
| } | ||
|
|
||
| ShopType shopType = ShopType.getType(shopSign); | ||
| if (shopType == null) { | ||
| TradeShop.getPlugin().getDebugger().log("ShopType.getType() returned null for sign: " + event.getLine(0), DebugLevels.SHOP_CREATION); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 50/50 on this one. This case should only come up if a shop is corrupted (I think, might be wrong), So I guess debug is fine, but the issue should probably be handled instead/as well. |
||
| return; | ||
| } | ||
| Player p = event.getPlayer(); | ||
|
|
||
| // Clear the first line since we already know it is going to be a Shop, and we have the type to pass separately | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Want to say no because it potentially breaks compatibility with older versions, but nothings working anyways so 🤷