suppress where fallback methods are implemented
This commit is contained in:
parent
ace4030de7
commit
e3d33c6e79
@ -1,5 +1,6 @@
|
|||||||
package me.xginko.villageroptimizer.commands.villageroptimizer.subcommands;
|
package me.xginko.villageroptimizer.commands.villageroptimizer.subcommands;
|
||||||
|
|
||||||
|
import io.papermc.paper.plugin.configuration.PluginMeta;
|
||||||
import me.xginko.villageroptimizer.VillagerOptimizer;
|
import me.xginko.villageroptimizer.VillagerOptimizer;
|
||||||
import me.xginko.villageroptimizer.commands.SubCommand;
|
import me.xginko.villageroptimizer.commands.SubCommand;
|
||||||
import me.xginko.villageroptimizer.enums.permissions.Commands;
|
import me.xginko.villageroptimizer.enums.permissions.Commands;
|
||||||
@ -28,26 +29,42 @@ public class VersionSubCmd extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings({"deprecation", "UnstableApiUsage"})
|
||||||
public void perform(CommandSender sender, String[] args) {
|
public void perform(CommandSender sender, String[] args) {
|
||||||
if (sender.hasPermission(Commands.VERSION.get())) {
|
if (!sender.hasPermission(Commands.VERSION.get())) {
|
||||||
|
sender.sendMessage(VillagerOptimizer.getLang(sender).no_permission);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String name, version, website, author;
|
||||||
|
|
||||||
|
try {
|
||||||
|
final PluginMeta pluginMeta = VillagerOptimizer.getInstance().getPluginMeta();
|
||||||
|
name = pluginMeta.getName();
|
||||||
|
version = pluginMeta.getVersion();
|
||||||
|
website = pluginMeta.getWebsite();
|
||||||
|
author = pluginMeta.getAuthors().get(0);
|
||||||
|
} catch (Throwable versionIncompatible) {
|
||||||
final PluginDescriptionFile pluginYML = VillagerOptimizer.getInstance().getDescription();
|
final PluginDescriptionFile pluginYML = VillagerOptimizer.getInstance().getDescription();
|
||||||
sender.sendMessage(
|
name = pluginYML.getName();
|
||||||
Component.newline()
|
version = pluginYML.getVersion();
|
||||||
|
website = pluginYML.getWebsite();
|
||||||
|
author = pluginYML.getAuthors().get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.sendMessage(Component.newline()
|
||||||
.append(
|
.append(
|
||||||
Component.text(pluginYML.getName()+" "+pluginYML.getVersion())
|
Component.text(name + " " + version)
|
||||||
.style(VillagerOptimizer.plugin_style)
|
.style(VillagerOptimizer.plugin_style)
|
||||||
.clickEvent(ClickEvent.openUrl(pluginYML.getWebsite()))
|
.clickEvent(ClickEvent.openUrl(website))
|
||||||
)
|
)
|
||||||
.append(Component.text(" by ").color(NamedTextColor.GRAY))
|
.append(Component.text(" by ").color(NamedTextColor.GRAY))
|
||||||
.append(
|
.append(
|
||||||
Component.text(pluginYML.getAuthors().get(0))
|
Component.text(author)
|
||||||
.color(NamedTextColor.WHITE)
|
.color(NamedTextColor.WHITE)
|
||||||
.clickEvent(ClickEvent.openUrl("https://github.com/xGinko"))
|
.clickEvent(ClickEvent.openUrl("https://github.com/xGinko"))
|
||||||
)
|
)
|
||||||
.append(Component.newline())
|
.append(Component.newline())
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
sender.sendMessage(VillagerOptimizer.getLang(sender).no_permission);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,6 +8,7 @@ import java.io.File;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
@SuppressWarnings({"ALL", "EscapedSpace"})
|
||||||
public class Config {
|
public class Config {
|
||||||
|
|
||||||
private final @NotNull ConfigFile config;
|
private final @NotNull ConfigFile config;
|
||||||
|
@ -54,6 +54,7 @@ public class EnableLeashingVillagers implements VillagerOptimizerModule, Listene
|
|||||||
return VillagerOptimizer.getConfiguration().getBoolean("gameplay.villagers-can-be-leashed.enable", false);
|
return VillagerOptimizer.getConfiguration().getBoolean("gameplay.villagers-can-be-leashed.enable", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
private void onLeash(PlayerInteractEntityEvent event) {
|
private void onLeash(PlayerInteractEntityEvent event) {
|
||||||
if (!event.getRightClicked().getType().equals(EntityType.VILLAGER)) return;
|
if (!event.getRightClicked().getType().equals(EntityType.VILLAGER)) return;
|
||||||
@ -80,7 +81,7 @@ public class EnableLeashingVillagers implements VillagerOptimizerModule, Listene
|
|||||||
PlayerLeashEntityEvent leashEvent;
|
PlayerLeashEntityEvent leashEvent;
|
||||||
try {
|
try {
|
||||||
leashEvent = new PlayerLeashEntityEvent(villager, player, player, event.getHand());
|
leashEvent = new PlayerLeashEntityEvent(villager, player, player, event.getHand());
|
||||||
} catch (Throwable versionException) {
|
} catch (Throwable versionIncompatible) {
|
||||||
leashEvent = new PlayerLeashEntityEvent(villager, player, player);
|
leashEvent = new PlayerLeashEntityEvent(villager, player, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user