mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-19 15:09:24 +00:00
2.2.21
This commit is contained in:
16
README.md
16
README.md
@@ -1,14 +1,14 @@
|
|||||||
# Custom-Fishing
|
# Custom-Fishing
|
||||||
|
|
||||||

|

|
||||||

|
|
||||||

|
|
||||||

|
|
||||||

|
|
||||||
[](https://jitpack.io/#Xiao-MoMi/Custom-Fishing)
|
[](https://jitpack.io/#Xiao-MoMi/Custom-Fishing)
|
||||||
<a href="https://mo-mi.gitbook.io/xiaomomi-plugins/plugin-wiki/customfishing" alt="GitBook">
|
<a href="https://mo-mi.gitbook.io/xiaomomi-plugins/plugin-wiki/customfishing" alt="GitBook">
|
||||||
<img src="https://img.shields.io/badge/docs-gitbook-brightgreen" alt="Gitbook"/>
|
<img src="https://img.shields.io/badge/docs-gitbook-brightgreen" alt="Gitbook"/>
|
||||||
</a>
|
</a>
|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
CustomFishing is a Paper plugin that provides minigames and a powerful condition & action system for fishing.
|
CustomFishing is a Paper plugin that provides minigames and a powerful condition & action system for fishing.
|
||||||
With the new concept of weight system, CustomFishing brings unlimited customization possibilities and best performance.
|
With the new concept of weight system, CustomFishing brings unlimited customization possibilities and best performance.
|
||||||
@@ -33,7 +33,7 @@ If you are using a proxy, configurate the proxy in gradle.properties. Otherwise
|
|||||||
Polymart: https://polymart.org/resource/customfishing.2723 \
|
Polymart: https://polymart.org/resource/customfishing.2723 \
|
||||||
Afdian: https://afdian.net/@xiaomomi
|
Afdian: https://afdian.net/@xiaomomi
|
||||||
|
|
||||||
## Use CustomFishing API
|
## CustomFishing API
|
||||||
|
|
||||||
### Maven
|
### Maven
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ Afdian: https://afdian.net/@xiaomomi
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.Xiao-MoMi</groupId>
|
<groupId>com.github.Xiao-MoMi</groupId>
|
||||||
<artifactId>Custom-Fishing</artifactId>
|
<artifactId>Custom-Fishing</artifactId>
|
||||||
<version>{LATEST}</version>
|
<version>{VERSION}</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
@@ -64,7 +64,7 @@ repositories {
|
|||||||
```
|
```
|
||||||
```
|
```
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly 'com.github.Xiao-MoMi:Custom-Fishing:{LATEST}'
|
compileOnly 'com.github.Xiao-MoMi:Custom-Fishing:{VERSION}'
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
### Gradle (Kotlin)
|
### Gradle (Kotlin)
|
||||||
@@ -76,6 +76,6 @@ repositories {
|
|||||||
```
|
```
|
||||||
```
|
```
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly("com.github.Xiao-MoMi:Custom-Fishing:{LATEST}")
|
compileOnly("com.github.Xiao-MoMi:Custom-Fishing:{VERSION}")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -54,7 +54,8 @@ public final class CompetitionGoal {
|
|||||||
public static final CompetitionGoal MIN_SIZE = new CompetitionGoal(
|
public static final CompetitionGoal MIN_SIZE = new CompetitionGoal(
|
||||||
"min_size", true,
|
"min_size", true,
|
||||||
((rankingProvider, player, score) -> {
|
((rankingProvider, player, score) -> {
|
||||||
if (-rankingProvider.getPlayerScore(player) > score) {
|
double previousScore = -rankingProvider.getPlayerScore(player);
|
||||||
|
if (previousScore == 0 || previousScore > score) {
|
||||||
rankingProvider.setData(player, -score);
|
rankingProvider.setData(player, -score);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -369,7 +369,9 @@ public abstract class ConfigManager implements ConfigLoader, Reloadable {
|
|||||||
@Override
|
@Override
|
||||||
public YamlDocument loadData(File file, char routeSeparator) {
|
public YamlDocument loadData(File file, char routeSeparator) {
|
||||||
try (InputStream inputStream = new FileInputStream(file)) {
|
try (InputStream inputStream = new FileInputStream(file)) {
|
||||||
return YamlDocument.create(inputStream, GeneralSettings.builder().setRouteSeparator(routeSeparator).build());
|
return YamlDocument.create(inputStream, GeneralSettings.builder()
|
||||||
|
.setRouteSeparator(routeSeparator)
|
||||||
|
.build());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
plugin.getPluginLogger().severe("Failed to load config " + file, e);
|
plugin.getPluginLogger().severe("Failed to load config " + file, e);
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|||||||
@@ -231,4 +231,24 @@ public class EffectImpl implements Effect {
|
|||||||
.properties(this.properties);
|
.properties(this.properties);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Effect{" +
|
||||||
|
"properties=" + properties +
|
||||||
|
", multipleLootChance=" + multipleLootChance +
|
||||||
|
", sizeAdder=" + sizeAdder +
|
||||||
|
", sizeMultiplier=" + sizeMultiplier +
|
||||||
|
", scoreAdder=" + scoreAdder +
|
||||||
|
", scoreMultiplier=" + scoreMultiplier +
|
||||||
|
", gameTimeAdder=" + gameTimeAdder +
|
||||||
|
", gameTimeMultiplier=" + gameTimeMultiplier +
|
||||||
|
", waitTimeAdder=" + waitTimeAdder +
|
||||||
|
", waitTimeMultiplier=" + waitTimeMultiplier +
|
||||||
|
", difficultyAdder=" + difficultyAdder +
|
||||||
|
", difficultyMultiplier=" + difficultyMultiplier +
|
||||||
|
", weightOperations=" + weightOperations +
|
||||||
|
", weightOperationsIgnored=" + weightOperationsIgnored +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -163,6 +163,7 @@ public class CustomFishingHook {
|
|||||||
// to update some properties
|
// to update some properties
|
||||||
mechanic.preStart();
|
mechanic.preStart();
|
||||||
Effect tempEffect = effect.copy();
|
Effect tempEffect = effect.copy();
|
||||||
|
|
||||||
for (EffectModifier modifier : gears.effectModifiers()) {
|
for (EffectModifier modifier : gears.effectModifiers()) {
|
||||||
for (TriConsumer<Effect, Context<Player>, Integer> consumer : modifier.modifiers()) {
|
for (TriConsumer<Effect, Context<Player>, Integer> consumer : modifier.modifiers()) {
|
||||||
consumer.accept(tempEffect, context, 1);
|
consumer.accept(tempEffect, context, 1);
|
||||||
@@ -175,7 +176,7 @@ public class CustomFishingHook {
|
|||||||
context.arg(ContextKeys.OTHER_Z, hook.getLocation().getBlockZ());
|
context.arg(ContextKeys.OTHER_Z, hook.getLocation().getBlockZ());
|
||||||
|
|
||||||
// get the next loot
|
// get the next loot
|
||||||
Loot loot = plugin.getLootManager().getNextLoot(effect, context);
|
Loot loot = plugin.getLootManager().getNextLoot(tempEffect, context);
|
||||||
if (loot != null) {
|
if (loot != null) {
|
||||||
this.nextLoot = loot;
|
this.nextLoot = loot;
|
||||||
|
|
||||||
@@ -517,7 +518,7 @@ public class CustomFishingHook {
|
|||||||
competition.refreshData(context.getHolder(), score);
|
competition.refreshData(context.getHolder(), score);
|
||||||
} else if (competition.getGoal() == CompetitionGoal.MAX_SIZE || competition.getGoal() == CompetitionGoal.MIN_SIZE) {
|
} else if (competition.getGoal() == CompetitionGoal.MAX_SIZE || competition.getGoal() == CompetitionGoal.MIN_SIZE) {
|
||||||
Float size = context.arg(ContextKeys.SIZE);
|
Float size = context.arg(ContextKeys.SIZE);
|
||||||
if (size != null) {
|
if (size != null && size > 0) {
|
||||||
competition.refreshData(context.getHolder(), size);
|
competition.refreshData(context.getHolder(), size);
|
||||||
}
|
}
|
||||||
} else if (competition.getGoal() == CompetitionGoal.TOTAL_SCORE) {
|
} else if (competition.getGoal() == CompetitionGoal.TOTAL_SCORE) {
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@@ -41,6 +42,13 @@ public interface LootManager extends Reloadable {
|
|||||||
*/
|
*/
|
||||||
boolean registerLoot(@NotNull Loot loot);
|
boolean registerLoot(@NotNull Loot loot);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all the registered loots
|
||||||
|
*
|
||||||
|
* @return registered loots
|
||||||
|
*/
|
||||||
|
Collection<Loot> getRegisteredLoots();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the members of a loot group identified by the given key.
|
* Retrieves the members of a loot group identified by the given key.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class ActionBarSender {
|
|||||||
@SuppressWarnings("DuplicatedCode")
|
@SuppressWarnings("DuplicatedCode")
|
||||||
private void updatePrivatePlaceholders() {
|
private void updatePrivatePlaceholders() {
|
||||||
double score = competition.getRanking().getPlayerScore(player.getName());
|
double score = competition.getRanking().getPlayerScore(player.getName());
|
||||||
this.privateContext.arg(ContextKeys.SCORE_FORMATTED, String.format("%.2f", competition.getGoal().isReversed() ? -score : score));
|
this.privateContext.arg(ContextKeys.SCORE_FORMATTED, score == 0 ? TranslationManager.miniMessageTranslation(MessageConstants.COMPETITION_NO_SCORE.build().key()) : String.format("%.2f", competition.getGoal().isReversed() ? -score : score));
|
||||||
this.privateContext.arg(ContextKeys.SCORE, competition.getGoal().isReversed() ? -score : score);
|
this.privateContext.arg(ContextKeys.SCORE, competition.getGoal().isReversed() ? -score : score);
|
||||||
int rank = competition.getRanking().getPlayerRank(player.getName());
|
int rank = competition.getRanking().getPlayerRank(player.getName());
|
||||||
this.privateContext.arg(ContextKeys.RANK, rank != -1 ? String.valueOf(rank) : TranslationManager.miniMessageTranslation(MessageConstants.COMPETITION_NO_RANK.build().key()));
|
this.privateContext.arg(ContextKeys.RANK, rank != -1 ? String.valueOf(rank) : TranslationManager.miniMessageTranslation(MessageConstants.COMPETITION_NO_RANK.build().key()));
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public class BossBarSender {
|
|||||||
@SuppressWarnings("DuplicatedCode")
|
@SuppressWarnings("DuplicatedCode")
|
||||||
private void updatePrivatePlaceholders() {
|
private void updatePrivatePlaceholders() {
|
||||||
double score = competition.getRanking().getPlayerScore(player.getName());
|
double score = competition.getRanking().getPlayerScore(player.getName());
|
||||||
this.privateContext.arg(ContextKeys.SCORE_FORMATTED, String.format("%.2f", competition.getGoal().isReversed() ? -score : score));
|
this.privateContext.arg(ContextKeys.SCORE_FORMATTED, score == 0 ? TranslationManager.miniMessageTranslation(MessageConstants.COMPETITION_NO_SCORE.build().key()) : String.format("%.2f", competition.getGoal().isReversed() ? -score : score));
|
||||||
this.privateContext.arg(ContextKeys.SCORE, competition.getGoal().isReversed() ? -score : score);
|
this.privateContext.arg(ContextKeys.SCORE, competition.getGoal().isReversed() ? -score : score);
|
||||||
int rank = competition.getRanking().getPlayerRank(player.getName());
|
int rank = competition.getRanking().getPlayerRank(player.getName());
|
||||||
this.privateContext.arg(ContextKeys.RANK, rank != -1 ? String.valueOf(rank) : TranslationManager.miniMessageTranslation(MessageConstants.COMPETITION_NO_RANK.build().key()));
|
this.privateContext.arg(ContextKeys.RANK, rank != -1 ? String.valueOf(rank) : TranslationManager.miniMessageTranslation(MessageConstants.COMPETITION_NO_RANK.build().key()));
|
||||||
|
|||||||
@@ -106,6 +106,11 @@ public class BukkitLootManager implements LootManager {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<Loot> getRegisteredLoots() {
|
||||||
|
return lootMap.values();
|
||||||
|
}
|
||||||
|
|
||||||
private void addGroupMember(String group, String member) {
|
private void addGroupMember(String group, String member) {
|
||||||
List<String> members = groupMembersMap.get(group);
|
List<String> members = groupMembersMap.get(group);
|
||||||
if (members == null) {
|
if (members == null) {
|
||||||
@@ -155,13 +160,16 @@ public class BukkitLootManager implements LootManager {
|
|||||||
}
|
}
|
||||||
for (Pair<String, BiFunction<Context<Player>, Double, Double>> pair : effect.weightOperations()) {
|
for (Pair<String, BiFunction<Context<Player>, Double, Double>> pair : effect.weightOperations()) {
|
||||||
double previous = lootWeightMap.getOrDefault(pair.left(), 0d);
|
double previous = lootWeightMap.getOrDefault(pair.left(), 0d);
|
||||||
if (previous > 0)
|
if (previous > 0) {
|
||||||
lootWeightMap.put(pair.left(), pair.right().apply(context, previous));
|
lootWeightMap.put(pair.left(), pair.right().apply(context, previous));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (Pair<String, BiFunction<Context<Player>, Double, Double>> pair : effect.weightOperationsIgnored()) {
|
for (Pair<String, BiFunction<Context<Player>, Double, Double>> pair : effect.weightOperationsIgnored()) {
|
||||||
double previous = lootWeightMap.getOrDefault(pair.left(), 0d);
|
double previous = lootWeightMap.getOrDefault(pair.left(), 0d);
|
||||||
lootWeightMap.put(pair.left(), pair.right().apply(context, previous));
|
lootWeightMap.put(pair.left(), pair.right().apply(context, previous));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
plugin.debug(lootWeightMap);
|
||||||
String lootID = WeightUtils.getRandom(lootWeightMap);
|
String lootID = WeightUtils.getRandom(lootWeightMap);
|
||||||
return Optional.ofNullable(lootID)
|
return Optional.ofNullable(lootID)
|
||||||
.map(id -> getLoot(lootID).orElseThrow(() -> new RuntimeException("Could not find loot " + lootID)))
|
.map(id -> getLoot(lootID).orElseThrow(() -> new RuntimeException("Could not find loot " + lootID)))
|
||||||
|
|||||||
@@ -916,6 +916,7 @@ red_snapper_fish:
|
|||||||
base: 10
|
base: 10
|
||||||
bonus: 2.3
|
bonus: 2.3
|
||||||
red_snapper_fish_silver_star:
|
red_snapper_fish_silver_star:
|
||||||
|
amount: 7~9
|
||||||
show-in-fishfinder: false
|
show-in-fishfinder: false
|
||||||
material: cod
|
material: cod
|
||||||
display:
|
display:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Project settings
|
# Project settings
|
||||||
# Rule: [major update].[feature update].[bug fix]
|
# Rule: [major update].[feature update].[bug fix]
|
||||||
project_version=2.2.0
|
project_version=2.2.1
|
||||||
config_version=34
|
config_version=34
|
||||||
project_group=net.momirealms
|
project_group=net.momirealms
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user