Skip to content

Commit

Permalink
Merge pull request #494 from Lapzupi/competition-strategy
Browse files Browse the repository at this point in the history
Competition Strategy
  • Loading branch information
Oheers authored Nov 25, 2024
2 parents 9644b99 + e22bcf0 commit 0bfd2a3
Show file tree
Hide file tree
Showing 30 changed files with 986 additions and 767 deletions.
10 changes: 5 additions & 5 deletions .github/ISSUE_TEMPLATE/1-bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ body:
label: Version
description: What version of our software are you running?
options:
- 1.7.4
- 1.7.3
- 1.7.2
- 1.7
- Development
- "1.7.4"
- "1.7.3"
- "1.7.2"
- "1.7"
- "Development"
validations:
required: true
- type: input
Expand Down
20 changes: 20 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Description
Provide a brief description of the changes in this pull request.

---

### What has changed?
Summarize the key changes in this pull request.

---

### Related Issues
Link related issues or describe which problem this PR fixes.

---

### Checklist

- [ ] I have added tests that prove my fix is effective or that my feature works.
- [ ] I have updated the documentation as needed.
- [ ] I have added any labels that fit this PR.
28 changes: 0 additions & 28 deletions .github/PULL_REQUEST_TEMPLATE.yml

This file was deleted.

7 changes: 6 additions & 1 deletion .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@ changelog:
- title: 🏕 Features
labels:
- "suggestion (plugin): added"
- "new feature"
- title: 🛠 Bug Fixes
labels:
- "bug: fixed"
- title: 📖 Documentation
labels:
- "suggestion (documentation): added"
- title: 🚀 Performance & Readability Improvements
labels:
- "optimizations (performance)"
- "optimizations (readability)"
- title: 👒 Dependencies
labels:
- dependencies
- dependencies
4 changes: 2 additions & 2 deletions even-more-fish-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ dependencies {
implementation(libs.acf)
implementation(libs.inventorygui)
implementation(libs.bundles.adventure)
implementation(libs.boostedyaml)
implementation(libs.vanishchecker)
implementation(libs.boostedyaml)

library(libs.friendlyid)
library(libs.flyway.core)
Expand Down Expand Up @@ -253,8 +253,8 @@ tasks {
relocate("co.aikar.locales", "com.oheers.fish.libs.locales")
relocate("de.themoep.inventorygui", "com.oheers.fish.libs.inventorygui")
relocate("net.kyori.adventure", "com.oheers.fish.libs.adventure")
relocate("dev.dejvokep.boostedyaml", "com.oheers.fish.libs.boostedyaml")
relocate("uk.firedev.vanishchecker", "com.oheers.fish.libs.vanishchecker")
relocate("dev.dejvokep", "com.oheers.fish.libs.boostedyaml")

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ private void saveUserData(boolean scheduler) {

private void saveFishReports() {
ConcurrentMap<UUID, List<FishReport>> allReports = DataManager.getInstance().getAllFishReports();
logger.info("Saving " + allReports.keySet().size() + " fish reports.");
logger.info("Saving " + allReports.size() + " fish reports.");
for (Map.Entry<UUID, List<FishReport>> entry : allReports.entrySet()) {
databaseV3.writeFishReports(entry.getKey(), entry.getValue());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,24 +120,16 @@ public String onPlaceholderRequest(Player player, @NotNull String identifier) {
}

CompetitionType competitionType = EvenMoreFish.getInstance().getActiveCompetition().getCompetitionType();
switch (competitionType) {
case LARGEST_FISH:
return new Message(ConfigMessage.COMPETITION_TYPE_LARGEST).getRawMessage();
case LARGEST_TOTAL:
return new Message(ConfigMessage.COMPETITION_TYPE_LARGEST_TOTAL).getRawMessage();
case MOST_FISH:
return new Message(ConfigMessage.COMPETITION_TYPE_MOST).getRawMessage();
case SPECIFIC_FISH:
return new Message(ConfigMessage.COMPETITION_TYPE_SPECIFIC).getRawMessage();
case SPECIFIC_RARITY:
return new Message(ConfigMessage.COMPETITION_TYPE_SPECIFIC_RARITY).getRawMessage();
case SHORTEST_FISH:
return new Message(ConfigMessage.COMPETITION_TYPE_SHORTEST).getRawMessage();
case SHORTEST_TOTAL:
return new Message(ConfigMessage.COMPETITION_TYPE_SHORTEST_TOTAL).getRawMessage();
default:
return "";
}
return switch (competitionType) {
case LARGEST_FISH -> new Message(ConfigMessage.COMPETITION_TYPE_LARGEST).getRawMessage();
case LARGEST_TOTAL -> new Message(ConfigMessage.COMPETITION_TYPE_LARGEST_TOTAL).getRawMessage();
case MOST_FISH -> new Message(ConfigMessage.COMPETITION_TYPE_MOST).getRawMessage();
case SPECIFIC_FISH -> new Message(ConfigMessage.COMPETITION_TYPE_SPECIFIC).getRawMessage();
case SPECIFIC_RARITY -> new Message(ConfigMessage.COMPETITION_TYPE_SPECIFIC_RARITY).getRawMessage();
case SHORTEST_FISH -> new Message(ConfigMessage.COMPETITION_TYPE_SHORTEST).getRawMessage();
case SHORTEST_TOTAL -> new Message(ConfigMessage.COMPETITION_TYPE_SHORTEST_TOTAL).getRawMessage();
default -> "";
};
}

// %emf_competition_place_player_1% would return the player in first place of any possible competition.
Expand Down Expand Up @@ -223,19 +215,8 @@ public String onPlaceholderRequest(Player player, @NotNull String identifier) {
}

message.setRarityColour(fish.getRarity().getColour());

if (fish.getDisplayName() != null) {
message.setFishCaught(fish.getDisplayName());
} else {
message.setFishCaught(fish.getName());
}

if (fish.getRarity().getDisplayName() != null) {
message.setRarity(fish.getRarity().getDisplayName());
} else {
message.setRarity(fish.getRarity().getValue());
}

message.setFishCaught(fish.getDisplayName());
message.setRarity(fish.getRarity().getDisplayName());
return message.getRawMessage();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private void registerAll() {
.toList();


final String message = String.format("%s new addons registered! (%s total)", registered.size(), addonMap.keySet().size());
final String message = String.format("%s new addons registered! (%s total)", registered.size(), addonMap.size());
plugin.getLogger().info(message);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ public ItemStack create(OfflinePlayer player) {
baitItem.setAmount(dropQuantity);

ItemMeta meta = baitItem.getItemMeta();
if (meta != null) meta.setLore(createBoostLore());
if (meta != null) {
meta.setLore(createBoostLore());
}
baitItem.setItemMeta(meta);

return BaitNBTManager.applyBaitNBT(baitItem, this.name);
Expand Down Expand Up @@ -175,20 +177,26 @@ public Fish chooseFish(Player player, Location location) {
} else {
fish = FishManager.getInstance().getFish(fishRarity, location, player, BaitFile.getInstance().getBoostRate(), getFishList(), true);
}
if (fish != null) fish.setWasBaited(true);
if (fish != null) {
fish.setWasBaited(true);
}

if (!getRarityList().contains(fishRarity) && (fish == null || !getFishList().contains(fish))) {
// boost effect chose a fish but the randomizer didn't pick out the right fish - they've been incorrectly boosted.
fish = FishManager.getInstance().getFish(fishRarity, location, player, 1, null, true);
if (fish != null) fish.setWasBaited(false);
if (fish != null) {
fish.setWasBaited(false);
}
} else {
alertUsage(player);
}
} else {
fish = FishManager.getInstance().getFish(fishRarity, location, player, 1, null, true);
if (getRarityList().contains(fishRarity)) {
alertUsage(player);
if (fish != null) fish.setWasBaited(true);
if (fish != null) {
fish.setWasBaited(true);
}
}
}

Expand All @@ -204,12 +212,13 @@ public Fish chooseFish(Player player, Location location) {
private void alertUsage(Player player) {
if (BaitFile.getInstance().alertOnBaitUse(this.name)) {
return;
} else {
Message message = new Message(ConfigMessage.BAIT_USED);
message.setBait(this.name);
message.setBaitTheme(this.theme);
message.broadcast(player);
}

Message message = new Message(ConfigMessage.BAIT_USED);
message.setBait(this.name);
message.setBaitTheme(this.theme);
message.broadcast(player);

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public void onStart(final CommandSender sender,
}


Competition comp = new Competition(duration, type, new ArrayList<>());
Competition comp = new Competition(duration, type);

comp.setCompetitionName("[admin_started]");
comp.setAdminStarted(true);
Expand Down
Loading

0 comments on commit 0bfd2a3

Please sign in to comment.