9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2025-12-19 15:09:24 +00:00

fix mongodb string url

This commit is contained in:
XiaoMoMi
2024-08-03 04:19:47 +08:00
parent 190c13c795
commit 5921b8823e
3 changed files with 47 additions and 62 deletions

View File

@@ -209,10 +209,8 @@ public class BukkitActionManager implements ActionManager<Player> {
double realRange = range.evaluate(context);
Player owner = context.getHolder();
Location location = requireNonNull(context.arg(ContextKeys.LOCATION));
plugin.getScheduler().sync().run(() -> {
for (Entity player : location.getWorld().getNearbyEntities(location, realRange, realRange, realRange, entity -> entity instanceof Player)) {
double distance = LocationUtils.getDistance(player.getLocation(), location);
if (distance <= realRange) {
for (Player player : Bukkit.getOnlinePlayers()) {
if (LocationUtils.getDistance(player.getLocation(), location) <= realRange) {
context.arg(ContextKeys.TEMP_NEAR_PLAYER, player.getName());
List<String> replaced = BukkitPlaceholderManager.getInstance().parse(
owner,
@@ -225,7 +223,6 @@ public class BukkitActionManager implements ActionManager<Player> {
}
}
}
}, location);
};
} else {
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at message-nearby action which should be Section");
@@ -280,10 +277,8 @@ public class BukkitActionManager implements ActionManager<Player> {
Player owner = context.getHolder();
double realRange = range.evaluate(context);
Location location = requireNonNull(context.arg(ContextKeys.LOCATION));
plugin.getScheduler().sync().run(() -> {
for (Entity player : location.getWorld().getNearbyEntities(location, realRange, realRange, realRange, entity -> entity instanceof Player)) {
double distance = LocationUtils.getDistance(player.getLocation(), location);
if (distance <= realRange) {
for (Player player : Bukkit.getOnlinePlayers()) {
if (LocationUtils.getDistance(player.getLocation(), location) <= realRange) {
context.arg(ContextKeys.TEMP_NEAR_PLAYER, player.getName());
List<String> replaced = BukkitPlaceholderManager.getInstance().parse(owner, cmd, context.placeholderMap());
for (String text : replaced) {
@@ -291,7 +286,6 @@ public class BukkitActionManager implements ActionManager<Player> {
}
}
}
}, null);
};
} else {
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at command-nearby action which should be Section");
@@ -336,18 +330,14 @@ public class BukkitActionManager implements ActionManager<Player> {
Player owner = context.getHolder();
Location location = requireNonNull(context.arg(ContextKeys.LOCATION));
double realRange = range.evaluate(context);
plugin.getScheduler().sync().run(() -> {
for (Entity player : location.getWorld().getNearbyEntities(location, realRange, realRange, realRange, entity -> entity instanceof Player)) {
double distance = LocationUtils.getDistance(player.getLocation(), location);
if (distance <= realRange) {
for (Player player : Bukkit.getOnlinePlayers()) {
if (LocationUtils.getDistance(player.getLocation(), location) <= realRange) {
context.arg(ContextKeys.TEMP_NEAR_PLAYER, player.getName());
String replaced = plugin.getPlaceholderManager().parse(owner, actionbar, context.placeholderMap());
Audience audience = plugin.getSenderFactory().getAudience(player);
audience.sendActionBar(AdventureHelper.miniMessage(replaced));
}
}
}, location
);
};
} else {
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at actionbar-nearby action which should be Section");
@@ -756,10 +746,8 @@ public class BukkitActionManager implements ActionManager<Player> {
return context -> {
if (Math.random() > chance) return;
Location location = requireNonNull(context.arg(ContextKeys.LOCATION));
plugin.getScheduler().sync().run(() -> {
for (Entity player : location.getWorld().getNearbyEntities(location, range, range, range, entity -> entity instanceof Player)) {
double distance = LocationUtils.getDistance(player.getLocation(), location);
if (distance <= range) {
for (Player player : Bukkit.getOnlinePlayers()) {
if (LocationUtils.getDistance(player.getLocation(), location) <= range) {
context.arg(ContextKeys.TEMP_NEAR_PLAYER, player.getName());
Audience audience = plugin.getSenderFactory().getAudience(player);
AdventureHelper.sendTitle(audience,
@@ -769,8 +757,6 @@ public class BukkitActionManager implements ActionManager<Player> {
);
}
}
}, location
);
};
} else {
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at title-nearby action which is expected to be `Section`");
@@ -806,10 +792,9 @@ public class BukkitActionManager implements ActionManager<Player> {
armorStand.equipment(EquipmentSlot.HEAD, plugin.getItemManager().buildInternal(context, finalItemID));
ArrayList<Player> viewers = new ArrayList<>();
if (range > 0) {
for (Entity player : location.getWorld().getNearbyEntities(location, range, range, range, entity -> entity instanceof Player)) {
double distance = LocationUtils.getDistance(player.getLocation(), location);
if (distance <= range) {
viewers.add((Player) player);
for (Player player : Bukkit.getOnlinePlayers()) {
if (LocationUtils.getDistance(player.getLocation(), location) <= range) {
viewers.add(player);
}
}
} else {
@@ -854,10 +839,9 @@ public class BukkitActionManager implements ActionManager<Player> {
armorStand.name(AdventureHelper.miniMessageToJson(text.render(context)));
ArrayList<Player> viewers = new ArrayList<>();
if (range > 0) {
for (Entity player : location.getWorld().getNearbyEntities(location, range, range, range, entity -> entity instanceof Player)) {
double distance = LocationUtils.getDistance(player.getLocation(), location);
if (distance <= range) {
viewers.add((Player) player);
for (Player player : Bukkit.getOnlinePlayers()) {
if (LocationUtils.getDistance(player.getLocation(), location) <= range) {
viewers.add(player);
}
}
} else {

View File

@@ -60,7 +60,8 @@ public class MongoDBProvider extends AbstractStorage {
var settings = MongoClientSettings.builder().uuidRepresentation(UuidRepresentation.STANDARD);
if (!section.getString("connection-uri", "").equals("")) {
settings.applyConnectionString(new ConnectionString(section.getString("connection-uri", "")));
mongoClient = MongoClients.create(settings.build());
this.mongoClient = MongoClients.create(settings.build());
this.database = mongoClient.getDatabase(section.getString("database", "minecraft"));
return;
}

View File

@@ -1,6 +1,6 @@
# Project settings
# Rule: [major update].[feature update].[bug fix]
project_version=2.2.13
project_version=2.2.14
config_version=35
project_group=net.momirealms