Compare commits

..
1 Commits
Author SHA1 Message Date
LoginExceptionandTechnicallyCoded 0f152ecb74 Added PAPI support. (#12)
Co-authored-by: TechnicallyCoded <technicallycoded@gmail.com>
2024-06-04 01:45:58 +02:00
53 changed files with 237 additions and 1611 deletions

No files matched your search

-165
View File
@@ -1,165 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
-46
View File
@@ -1,46 +0,0 @@
# PlayerBountiesPlus
## Overview
PlayerBountiesPlus lets players set and claim bounties while blocking teammates from claiming rewards. Hooks into Vault for economy handling and supports many team plugins.
## Features
- Clan-aware bounty system that prevents teammates from claiming each other's bounties
- Integrates with Vault and supports ClansLite, Parties, BetterTeams, SimpleClans and Towny for team detection
- Inventory GUI for viewing bounties
- PlaceholderAPI support for custom placeholders
- Localized messages in multiple languages
## Commands
- `/bounty set <player> <amount>` – set a bounty on a player
- `/bounty top` – list the top bounties
- `/bounty check <player>` – check a player's bounty
- `/pbp reload` – reload configuration and messages
- `/pbp version` – display plugin version
- `/pbp bounty set <player> <amount>` – admin set a bounty
- `/pbp bounty add <player> <amount>` – add to a bounty
- `/pbp bounty remove <player> <amount>` – remove from a bounty
- `/pbp bounty delete <player>` – delete a bounty
- `/pbp bounty get <player>` – view a bounty
## Permissions
| Permission | Default |
| --- | --- |
| `playerbountiesplus.command.bounty` | all |
| `playerbountiesplus.command.bounty.set` | all |
| `playerbountiesplus.event.claim` | all |
| `playerbountiesplus.command.admin` | op |
| `playerbountiesplus.command.admin.version` | op |
| `playerbountiesplus.command.admin.reload` | op |
| `playerbountiesplus.command.admin.bounty.set` | op |
| `playerbountiesplus.command.admin.bounty.add` | op |
| `playerbountiesplus.command.admin.bounty.remove` | op |
| `playerbountiesplus.command.admin.bounty.delete` | op |
| `playerbountiesplus.command.admin.bounty.get` | op |
## Developer Notes
- Commands reside in `com.tcoded.playerbountiesplus.command` with subpackages for bounty and admin actions
- Event listeners like `DeathListener` handle bounty claim logic
- Hooks under `com.tcoded.playerbountiesplus.hook` integrate with Vault, PlaceholderAPI and team plugins
- Inventory GUIs in `com.tcoded.playerbountiesplus.gui` present bounty data
- `BountyDataManager` manages persistence of bounties
+28 -17
View File
@@ -6,7 +6,7 @@
<groupId>com.tcoded</groupId>
<artifactId>PlayerBountiesPlus</artifactId>
<version>1.4.17</version>
<version>1.4.8</version>
<packaging>jar</packaging>
<name>PlayerBountiesPlus</name>
@@ -71,6 +71,10 @@
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>placeholderapi</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
@@ -79,6 +83,18 @@
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>devmart-other</id>
<url>https://nexuslite.gcnt.net/repos/other/</url>
</repository>
<repository>
<id>devmart-public</id>
<url>https://nexuslite.gcnt.net/repos/public/</url>
</repository>
<repository>
<id>devmart-tcoded</id>
<url>https://nexuslite.gcnt.net/repos/tcoded/</url>
</repository>
<repository>
<id>codemc-repo</id>
<url>https://repo.codemc.org/repository/maven-public</url>
@@ -87,10 +103,6 @@
<id>glaremasters repo</id>
<url>https://repo.glaremasters.me/repository/towny/</url>
</repository>
<repository>
<id>placeholderapi</id>
<url>https://repo.extendedclip.com/releases/</url>
</repository>
</repositories>
<dependencies>
@@ -112,6 +124,12 @@
<version>23.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.CraptiCraft-Development</groupId>
<artifactId>ClansLite-API</artifactId>
@@ -119,9 +137,9 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.TechnicallyCoded</groupId>
<groupId>com.tcoded</groupId>
<artifactId>FoliaLib</artifactId>
<version>0.4.3</version>
<version>0.2.6</version>
<scope>compile</scope>
</dependency>
<dependency>
@@ -138,9 +156,9 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.LightLibs</groupId>
<groupId>com.tcoded.lightlibs</groupId>
<artifactId>SpigotUpdateChecker</artifactId>
<version>1.1.3</version>
<version>1.1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
@@ -164,8 +182,7 @@
<dependency>
<groupId>com.github.SaberLLC</groupId>
<artifactId>Saber-Factions</artifactId>
<version>4.1.4-STABLE</version>
<scope>provided</scope>
<version>4.1.2-STABLE</version>
</dependency>
<dependency>
<groupId>com.palmergames.bukkit.towny</groupId>
@@ -173,11 +190,5 @@
<version>0.100.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.6</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
@@ -2,21 +2,20 @@ package com.tcoded.playerbountiesplus;
import com.google.common.collect.ImmutableList;
import com.tcoded.folialib.FoliaLib;
import com.tcoded.lightlibs.updatechecker.SimpleUpdateChecker;
import com.tcoded.playerbountiesplus.command.BountyCommand;
import com.tcoded.playerbountiesplus.command.PlayerBountiesPlusAdminCmd;
import com.tcoded.playerbountiesplus.hook.currency.EconomyHook;
import com.tcoded.playerbountiesplus.hook.PAPIExpansion;
import com.tcoded.playerbountiesplus.hook.currency.AbstractEconomyHook;
import com.tcoded.playerbountiesplus.hook.currency.DummyEcoHook;
import com.tcoded.playerbountiesplus.hook.currency.VaultHook;
import com.tcoded.playerbountiesplus.hook.placeholder.PlaceholderHook;
import com.tcoded.playerbountiesplus.hook.team.AbstractTeamHook;
import com.tcoded.playerbountiesplus.hook.team.TeamHook;
import com.tcoded.playerbountiesplus.listener.DeathListener;
import com.tcoded.playerbountiesplus.listener.GuiListener;
import com.tcoded.playerbountiesplus.manager.BountyDataManager;
import com.tcoded.playerbountiesplus.util.LangUtil;
import com.tcoded.updatechecker.SimpleUpdateChecker;
import org.bstats.bukkit.Metrics;
import org.bstats.charts.SimplePie;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.PluginCommand;
import org.bukkit.configuration.file.FileConfiguration;
@@ -46,9 +45,10 @@ public final class PlayerBountiesPlus extends JavaPlugin {
private BountyDataManager bountyDataManager;
// Hooks
private EconomyHook ecoHook;
private TeamHook teamHook;
private PlaceholderHook placeholderHook;
private AbstractEconomyHook ecoHook;
private AbstractTeamHook teamHook;
private PAPIExpansion papiExpansion;
public PlayerBountiesPlus() {
instance = this;
@@ -73,15 +73,11 @@ public final class PlayerBountiesPlus extends JavaPlugin {
if (!applyEcoHookRegistration()) return;
// Team Hooks
this.teamHook = TeamHook.findTeamHook(this);
this.teamHook = AbstractTeamHook.findTeamHook(this);
if (this.teamHook == null) {
getLogger().warning("There is no supported team/clan/party plugin on the server! Feel free to request support for the plugin you use on GitHub or Discord!");
}
// Placeholder Hooks
this.placeholderHook = PlaceholderHook.findPlaceholderHook(this);
this.placeholderHook.enable();
// Commands
PluginCommand bountyCmd = this.getCommand("bounty");
if (bountyCmd != null) {
@@ -96,9 +92,8 @@ public final class PlayerBountiesPlus extends JavaPlugin {
adminCmd.setTabCompleter(adminExec);
}
// Listeners
// Listener
this.getServer().getPluginManager().registerEvents(new DeathListener(this), this);
this.getServer().getPluginManager().registerEvents(new GuiListener(), this);
// Update checker
checkUpdate();
@@ -119,6 +114,11 @@ public final class PlayerBountiesPlus extends JavaPlugin {
findPluginWithQuery(plugins, metrics, "parties");
findPluginWithQuery(plugins, metrics, "guild");
findPluginWithQuery(plugins, metrics, "guilds");
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
papiExpansion = new PAPIExpansion(this);
papiExpansion.register();
}
}
public void reloadLang() {
@@ -130,28 +130,23 @@ public final class PlayerBountiesPlus extends JavaPlugin {
this,
ChatColor.translateAlternateColorCodes('&', "&f[&bPlayerBountiesPlus&f] "),
108637,
runnable -> this.getFoliaLib().getScheduler().runAsync(wt -> runnable.run())
runnable -> this.getFoliaLib().getImpl().runAsync(runnable)
);
}
@Override
public void onDisable() {
HandlerList.unregisterAll(this);
this.placeholderHook.disable();
}
public EconomyHook getEcoHook() {
public AbstractEconomyHook getEcoHook() {
return this.ecoHook;
}
public TeamHook getTeamHook() {
public AbstractTeamHook getTeamHook() {
return teamHook;
}
public PlaceholderHook getPlaceholderHook() {
return placeholderHook;
}
public BountyDataManager getBountyDataManager() {
return bountyDataManager;
}
@@ -200,14 +195,14 @@ public final class PlayerBountiesPlus extends JavaPlugin {
boolean ecoPresent = vaultEcoHook.init();
// Register or fallback
if (ecoPresent) servicesManager.register(EconomyHook.class, vaultEcoHook, this, ServicePriority.Low);
else servicesManager.register(EconomyHook.class, new DummyEcoHook(), this, ServicePriority.Lowest);
if (ecoPresent) servicesManager.register(AbstractEconomyHook.class, vaultEcoHook, this, ServicePriority.Low);
else servicesManager.register(AbstractEconomyHook.class, new DummyEcoHook(), this, ServicePriority.Lowest);
}
public boolean applyEcoHookRegistration() {
// Get economy hook
ServicesManager servicesManager = getServer().getServicesManager();
RegisteredServiceProvider<EconomyHook> ecoHookProvider = servicesManager.getRegistration(EconomyHook.class);
RegisteredServiceProvider<AbstractEconomyHook> ecoHookProvider = servicesManager.getRegistration(AbstractEconomyHook.class);
if (ecoHookProvider == null) {
getLogger().severe("No economy hook is present! Aborting startup!");
return false;
@@ -1,6 +1,5 @@
package com.tcoded.playerbountiesplus.command;
import com.google.common.collect.Lists;
import com.tcoded.playerbountiesplus.PlayerBountiesPlus;
import com.tcoded.playerbountiesplus.command.bounty.BountyCheckCmd;
import com.tcoded.playerbountiesplus.command.bounty.BountySetCmd;
@@ -9,12 +8,12 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
public class BountyCommand implements CommandExecutor, TabCompleter {
@@ -52,27 +51,35 @@ public class BountyCommand implements CommandExecutor, TabCompleter {
@Nullable
@Override
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (args.length == 1) {
return Lists.newArrayList("set", "top", "check").stream()
.filter(action -> action.startsWith(args[0].toLowerCase()))
.collect(Collectors.toList());
} else if (args.length > 1) {
String subCommand = args[0].toLowerCase();
switch (subCommand) {
case "set":
return BountySetCmd.onTabComplete(sender, args).stream()
.filter(suggestion -> suggestion.toLowerCase().startsWith(args[1].toLowerCase()))
.collect(Collectors.toList());
case "check":
return BountyCheckCmd.onTabComplete(sender, args).stream()
.filter(suggestion -> suggestion.toLowerCase().startsWith(args[1].toLowerCase()))
.collect(Collectors.toList());
case "top":
return Collections.emptyList(); // No additional arguments for top
default:
return Collections.emptyList();
@Nullable List<String> options = new ArrayList<>();
if (args.length < 2) {
String arg0 = args[0].toLowerCase();
String[] actions = {"set", "top", "check"};
for (String action : actions) {
if (action.startsWith(arg0)) {
options.add(action);
}
}
}
return Collections.emptyList();
else if (args.length == 2) {
String arg0 = args[0].toLowerCase();
String arg1 = args[1].toLowerCase();
if (arg0.equals("set") || arg0.equals("check")) {
this.plugin.getServer().getOnlinePlayers().stream()
.map(Player::getName)
.filter(name -> name.toLowerCase().startsWith(arg1))
.forEach(options::add);
}
}
else if (args.length == 3) {
String arg0 = args[0].toLowerCase();
String arg2 = args[2].toLowerCase();
if (arg0.equals("set")) {
if (arg2.equals("")) options.add("<amount>");
}
}
return options;
}
}
@@ -4,7 +4,6 @@ import com.google.common.collect.Lists;
import com.tcoded.playerbountiesplus.PlayerBountiesPlus;
import com.tcoded.playerbountiesplus.command.admin.PlayerBountiesPlusReloadCmd;
import com.tcoded.playerbountiesplus.command.admin.PlayerBountiesPlusVersionCmd;
import com.tcoded.playerbountiesplus.command.admin.bounty.AdminBountyCmd;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@@ -14,12 +13,11 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
public class PlayerBountiesPlusAdminCmd implements CommandExecutor, TabCompleter {
private static final ArrayList<String> completions = Lists.newArrayList("reload", "version", "bounty", "help");
private static final ArrayList<String> completions = Lists.newArrayList("reload", "version", "help");
private final PlayerBountiesPlus plugin;
@@ -42,8 +40,6 @@ public class PlayerBountiesPlusAdminCmd implements CommandExecutor, TabCompleter
return PlayerBountiesPlusReloadCmd.handleCmd(plugin, sender, command, label, args);
case "version":
return PlayerBountiesPlusVersionCmd.handleCmd(plugin, sender, command, label, args);
case "bounty":
return AdminBountyCmd.handleCmd(plugin, sender, command, label, args);
default:
sendHelpMsg(sender);
return true;
@@ -56,10 +52,6 @@ public class PlayerBountiesPlusAdminCmd implements CommandExecutor, TabCompleter
"&fAdmin Commands:\n" +
"&f/pbp reload &7- Reload the configuration file and the messages.\n" +
"&f/pbp version &7- Check the version of the plugin.\n" +
"&f/pbp bounty set <player> <amount> &7- Set a player's bounty.\n" +
"&f/pbp bounty add <player> <amount> &7- Add to a player's bounty.\n" +
"&f/pbp bounty remove <player> <amount> &7- Remove from a player's bounty.\n" +
"&f/pbp bounty delete <player> &7- Delete a player's bounty.\n" +
"&f/pbp help &7- Get this message."
));
}
@@ -67,24 +59,8 @@ public class PlayerBountiesPlusAdminCmd implements CommandExecutor, TabCompleter
@Nullable
@Override
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (args.length == 1) {
return completions.stream()
.filter(s -> s.toLowerCase().startsWith(args[0].toLowerCase()))
.collect(Collectors.toList());
} else if (args.length > 1) {
String subCommand = args[0].toLowerCase();
switch (subCommand) {
case "bounty":
return AdminBountyCmd.onTabComplete(sender, args);
case "version":
return PlayerBountiesPlusVersionCmd.onTabComplete(sender, args);
case "reload":
case "help":
return Collections.emptyList(); // No additional arguments for reload or help
default:
return Collections.emptyList();
}
}
return Collections.emptyList();
return completions.stream()
.filter(s -> s.startsWith(args[0].toLowerCase()))
.collect(Collectors.toList());
}
}
@@ -3,14 +3,8 @@ package com.tcoded.playerbountiesplus.command.admin;
import com.tcoded.playerbountiesplus.PlayerBountiesPlus;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
public class PlayerBountiesPlusReloadCmd implements TabCompleter {
public class PlayerBountiesPlusReloadCmd {
private static final String RELOAD_PERMISSION = "playerbountiesplus.command.playerbountiesplus.reload";
@@ -34,10 +28,4 @@ public class PlayerBountiesPlusReloadCmd implements TabCompleter {
return true;
}
@Nullable
@Override
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
// No additional arguments for reload command
return Collections.emptyList();
}
}
@@ -6,9 +6,6 @@ import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import java.util.Collections;
import java.util.List;
public class PlayerBountiesPlusVersionCmd {
private static final String VERSION_PERMISSION = "playerbountiesplus.command.playerbountiesplus.version";
@@ -34,8 +31,4 @@ public class PlayerBountiesPlusVersionCmd {
return true;
}
public static List<String> onTabComplete(CommandSender sender, String[] args) {
// No sub-commands for version, return empty list
return Collections.emptyList();
}
}
@@ -1,77 +0,0 @@
package com.tcoded.playerbountiesplus.command.admin.bounty;
import com.tcoded.playerbountiesplus.PlayerBountiesPlus;
import com.tcoded.playerbountiesplus.manager.BountyDataManager;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
public class AdminBountyAddCmd {
private static final String PERMISSION = "playerbountiesplus.command.admin.bounty.add";
public static boolean handleCmd(PlayerBountiesPlus plugin, CommandSender sender, Command cmd, String label, String[] args) {
if (!sender.hasPermission(PERMISSION)) {
String noPerm = plugin.getLang().getColored("command.no-permission");
String noPermDetailed = plugin.getLang().getColored("command.no-permission-detailed")
.replace("{no-permission-msg}", noPerm)
.replace("{permission}", PERMISSION);
sender.sendMessage(noPermDetailed);
return true;
}
if (args.length < 4) {
sender.sendMessage(plugin.getLang().getColored("command.admin.bounty.add.missing-args"));
return true;
}
String playerName = args[2];
int amount;
try {
amount = Integer.parseInt(args[3]);
} catch (NumberFormatException ex) {
sender.sendMessage(plugin.getLang().getColored("command.admin.bounty.add.amount-nan"));
return true;
}
OfflinePlayer target = plugin.getServer().getOfflinePlayer(playerName);
if (target == null || (!target.hasPlayedBefore() && !target.isOnline())) {
sender.sendMessage(plugin.getLang().getColored("command.admin.bounty.add.player-not-found"));
return true;
}
UUID uuid = target.getUniqueId();
BountyDataManager m = plugin.getBountyDataManager();
int current = m.getBounty(uuid);
int total = current + amount;
m.setBounty(uuid, total);
m.saveBountiesAsync();
sender.sendMessage(plugin.getLang().getColored("command.admin.bounty.add.success")
.replace("{target}", target.getName())
.replace("{amount}", String.valueOf(amount))
.replace("{total}", String.valueOf(total)));
return true;
}
@Nullable
public static List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (args.length == 3) {
// Suggest all online player names for the username
return sender.getServer().getOnlinePlayers().stream()
.map(player -> player.getName())
.collect(Collectors.toList());
} else if (args.length == 4) {
// Suggest a placeholder for the amount
return Collections.singletonList("<amount>");
}
return Collections.emptyList();
}
}
@@ -1,69 +0,0 @@
package com.tcoded.playerbountiesplus.command.admin.bounty;
import com.tcoded.playerbountiesplus.PlayerBountiesPlus;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
public class AdminBountyCmd {
public static boolean handleCmd(PlayerBountiesPlus plugin, CommandSender sender, Command cmd, String label, String[] args) {
if (args.length < 2) {
sender.sendMessage(plugin.getLang().getColored("command.bounty.no-action"));
return true;
}
String action = args[1].toLowerCase();
switch (action) {
case "set":
return AdminBountySetCmd.handleCmd(plugin, sender, cmd, label, args);
case "add":
return AdminBountyAddCmd.handleCmd(plugin, sender, cmd, label, args);
case "remove":
return AdminBountyRemoveCmd.handleCmd(plugin, sender, cmd, label, args);
case "delete":
return AdminBountyDeleteCmd.handleCmd(plugin, sender, cmd, label, args);
case "get":
return AdminBountyGetCmd.handleCmd(plugin, sender, cmd, label, args);
default:
sender.sendMessage(plugin.getLang().getColored("command.bounty.invalid-action"));
return true;
}
}
public static List<String> onTabComplete(CommandSender sender, String[] args) {
List<String> suggestions = Collections.emptyList();
if (args.length == 2) {
suggestions = Arrays.asList("set", "add", "remove", "delete", "get");
} else if (args.length > 2) {
String sub = args[1].toLowerCase();
switch (sub) {
case "add":
suggestions = AdminBountyAddCmd.onTabComplete(sender, null, null, args);
break;
case "remove":
suggestions = AdminBountyRemoveCmd.onTabComplete(sender, null, null, args);
break;
case "delete":
suggestions = AdminBountyDeleteCmd.onTabComplete(sender, null, null, args);
break;
case "get":
suggestions = AdminBountyGetCmd.onTabComplete(sender, null, null, args);
break;
case "set":
suggestions = AdminBountySetCmd.onTabComplete(sender, null, null, args);
break;
}
}
String input = args[args.length - 1].toLowerCase();
return suggestions.stream()
.filter(opt -> opt.toLowerCase().startsWith(input))
.collect(Collectors.toList());
}
}
@@ -1,63 +0,0 @@
package com.tcoded.playerbountiesplus.command.admin.bounty;
import com.tcoded.playerbountiesplus.PlayerBountiesPlus;
import com.tcoded.playerbountiesplus.manager.BountyDataManager;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
public class AdminBountyDeleteCmd {
private static final String PERMISSION = "playerbountiesplus.command.admin.bounty.delete";
public static boolean handleCmd(PlayerBountiesPlus plugin, CommandSender sender, Command cmd, String label, String[] args) {
if (!sender.hasPermission(PERMISSION)) {
String noPerm = plugin.getLang().getColored("command.no-permission");
String noPermDetailed = plugin.getLang().getColored("command.no-permission-detailed")
.replace("{no-permission-msg}", noPerm)
.replace("{permission}", PERMISSION);
sender.sendMessage(noPermDetailed);
return true;
}
if (args.length < 3) {
sender.sendMessage(plugin.getLang().getColored("command.admin.bounty.delete.missing-args"));
return true;
}
String playerName = args[2];
OfflinePlayer target = plugin.getServer().getOfflinePlayer(playerName);
if (target == null || (!target.hasPlayedBefore() && !target.isOnline())) {
sender.sendMessage(plugin.getLang().getColored("command.admin.bounty.delete.player-not-found"));
return true;
}
UUID uuid = target.getUniqueId();
BountyDataManager m = plugin.getBountyDataManager();
m.removeBounty(uuid);
m.saveBountiesAsync();
sender.sendMessage(plugin.getLang().getColored("command.admin.bounty.delete.success")
.replace("{target}", target.getName()));
return true;
}
@Nullable
public static List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (args.length == 3) {
// Suggest all online player names for the username
return sender.getServer().getOnlinePlayers().stream()
.map(Player::getName)
.collect(Collectors.toList());
}
return Collections.emptyList();
}
}
@@ -1,63 +0,0 @@
package com.tcoded.playerbountiesplus.command.admin.bounty;
import com.tcoded.playerbountiesplus.PlayerBountiesPlus;
import com.tcoded.playerbountiesplus.manager.BountyDataManager;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
public class AdminBountyGetCmd {
private static final String PERMISSION = "playerbountiesplus.command.admin.bounty.get";
public static boolean handleCmd(PlayerBountiesPlus plugin, CommandSender sender, Command cmd, String label, String[] args) {
if (!sender.hasPermission(PERMISSION)) {
String noPerm = plugin.getLang().getColored("command.no-permission");
String noPermDetailed = plugin.getLang().getColored("command.no-permission-detailed")
.replace("{no-permission-msg}", noPerm)
.replace("{permission}", PERMISSION);
sender.sendMessage(noPermDetailed);
return true;
}
if (args.length < 3) {
sender.sendMessage(plugin.getLang().getColored("command.admin.bounty.get.missing-args"));
return true;
}
String playerName = args[2];
OfflinePlayer target = plugin.getServer().getOfflinePlayer(playerName);
if (target == null || (!target.hasPlayedBefore() && !target.isOnline())) {
sender.sendMessage(plugin.getLang().getColored("command.admin.bounty.get.player-not-found"));
return true;
}
UUID uuid = target.getUniqueId();
BountyDataManager m = plugin.getBountyDataManager();
int current = m.getBounty(uuid);
sender.sendMessage(plugin.getLang().getColored("command.admin.bounty.get.success")
.replace("{target}", target.getName())
.replace("{bounty}", String.valueOf(current)));
return true;
}
@Nullable
public static List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (args.length == 3) {
// Suggest all online player names for the username
return sender.getServer().getOnlinePlayers().stream()
.map(player -> player.getName())
.collect(Collectors.toList());
}
return Collections.emptyList();
}
}
@@ -1,82 +0,0 @@
package com.tcoded.playerbountiesplus.command.admin.bounty;
import com.tcoded.playerbountiesplus.PlayerBountiesPlus;
import com.tcoded.playerbountiesplus.manager.BountyDataManager;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
public class AdminBountyRemoveCmd {
private static final String PERMISSION = "playerbountiesplus.command.admin.bounty.remove";
public static boolean handleCmd(PlayerBountiesPlus plugin, CommandSender sender, Command cmd, String label, String[] args) {
if (!sender.hasPermission(PERMISSION)) {
String noPerm = plugin.getLang().getColored("command.no-permission");
String noPermDetailed = plugin.getLang().getColored("command.no-permission-detailed")
.replace("{no-permission-msg}", noPerm)
.replace("{permission}", PERMISSION);
sender.sendMessage(noPermDetailed);
return true;
}
if (args.length < 4) {
sender.sendMessage(plugin.getLang().getColored("command.admin.bounty.remove.missing-args"));
return true;
}
String playerName = args[2];
int amount;
try {
amount = Integer.parseInt(args[3]);
} catch (NumberFormatException ex) {
sender.sendMessage(plugin.getLang().getColored("command.admin.bounty.remove.amount-nan"));
return true;
}
OfflinePlayer target = plugin.getServer().getOfflinePlayer(playerName);
if (target == null || (!target.hasPlayedBefore() && !target.isOnline())) {
sender.sendMessage(plugin.getLang().getColored("command.admin.bounty.remove.player-not-found"));
return true;
}
UUID uuid = target.getUniqueId();
BountyDataManager m = plugin.getBountyDataManager();
int current = m.getBounty(uuid);
int total = current - amount;
if (total <= 0) {
m.removeBounty(uuid);
total = 0;
} else {
m.setBounty(uuid, total);
}
m.saveBountiesAsync();
sender.sendMessage(plugin.getLang().getColored("command.admin.bounty.remove.success")
.replace("{target}", target.getName())
.replace("{amount}", String.valueOf(amount))
.replace("{total}", String.valueOf(total)));
return true;
}
@Nullable
public static List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (args.length == 3) {
// Suggest all online player names for the username
return sender.getServer().getOnlinePlayers().stream()
.map(player -> player.getName())
.collect(Collectors.toList());
} else if (args.length == 4) {
// Suggest a placeholder for the amount
return Collections.singletonList("<amount>");
}
return Collections.emptyList();
}
}
@@ -1,74 +0,0 @@
package com.tcoded.playerbountiesplus.command.admin.bounty;
import com.tcoded.playerbountiesplus.PlayerBountiesPlus;
import com.tcoded.playerbountiesplus.manager.BountyDataManager;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
public class AdminBountySetCmd {
private static final String PERMISSION = "playerbountiesplus.command.admin.bounty.set";
public static boolean handleCmd(PlayerBountiesPlus plugin, CommandSender sender, Command cmd, String label, String[] args) {
if (!sender.hasPermission(PERMISSION)) {
String noPerm = plugin.getLang().getColored("command.no-permission");
String noPermDetailed = plugin.getLang().getColored("command.no-permission-detailed")
.replace("{no-permission-msg}", noPerm)
.replace("{permission}", PERMISSION);
sender.sendMessage(noPermDetailed);
return true;
}
if (args.length < 4) {
sender.sendMessage(plugin.getLang().getColored("command.admin.bounty.set.missing-args"));
return true;
}
String playerName = args[2];
int amount;
try {
amount = Integer.parseInt(args[3]);
} catch (NumberFormatException ex) {
sender.sendMessage(plugin.getLang().getColored("command.admin.bounty.set.amount-nan"));
return true;
}
OfflinePlayer target = plugin.getServer().getOfflinePlayer(playerName);
if (target == null || (!target.hasPlayedBefore() && !target.isOnline())) {
sender.sendMessage(plugin.getLang().getColored("command.admin.bounty.set.player-not-found"));
return true;
}
UUID uuid = target.getUniqueId();
BountyDataManager m = plugin.getBountyDataManager();
m.setBounty(uuid, amount);
m.saveBountiesAsync();
sender.sendMessage(plugin.getLang().getColored("command.admin.bounty.set.success")
.replace("{target}", target.getName())
.replace("{bounty}", String.valueOf(amount)));
return true;
}
@Nullable
public static List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (args.length == 3) {
// Suggest all online player names for the username
return sender.getServer().getOnlinePlayers().stream()
.map(player -> player.getName())
.collect(Collectors.toList());
} else if (args.length == 4) {
// Suggest a placeholder for the amount
return Collections.singletonList("<amount>");
}
return Collections.emptyList();
}
}
@@ -1,18 +1,11 @@
package com.tcoded.playerbountiesplus.command.bounty;
import com.tcoded.playerbountiesplus.PlayerBountiesPlus;
import com.tcoded.playerbountiesplus.manager.BountyDataManager;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
public class BountyCheckCmd {
@@ -33,16 +26,14 @@ public class BountyCheckCmd {
UUID playerUUID = target.getUniqueId();
BountyDataManager bountyDataManager = plugin.getBountyDataManager();
boolean hasBounty = bountyDataManager.hasBounty(playerUUID);
Integer amount = plugin.getBountyDataManager().getBounties().get(playerUUID);
if (hasBounty) {
if (amount != null && amount > 0) {
// Confirmation
int bounty = bountyDataManager.getBounty(playerUUID);
sender.sendMessage(
plugin.getLang().getColored("command.bounty.check.bounty-found")
.replace("{target}", target.getName())
.replace("{bounty}", Integer.toString(bounty))
.replace("{bounty}", amount.toString())
);
} else {
sender.sendMessage(
@@ -53,16 +44,4 @@ public class BountyCheckCmd {
return true;
}
@Nullable
public static List<String> onTabComplete(@NotNull CommandSender sender, @NotNull String[] args) {
if (args.length == 2) {
// Suggest online player names for the username
return sender.getServer().getOnlinePlayers().stream()
.map(Player::getName)
.filter(name -> name.toLowerCase().startsWith(args[1].toLowerCase()))
.collect(Collectors.toList());
}
return Collections.emptyList();
}
}
@@ -1,18 +1,12 @@
package com.tcoded.playerbountiesplus.command.bounty;
import com.tcoded.playerbountiesplus.PlayerBountiesPlus;
import com.tcoded.playerbountiesplus.event.BountySetEvent;
import com.tcoded.playerbountiesplus.manager.BountyDataManager;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
import java.util.concurrent.ConcurrentHashMap;
public class BountySetCmd {
@@ -22,17 +16,8 @@ public class BountySetCmd {
return true;
}
if (sender instanceof Player && !sender.hasPermission("playerbountiesplus.command.bounty.set")) {
String noPerm = plugin.getLang().getColored("command.no-permission");
String noPermDetailed = plugin.getLang().getColored("command.no-permission-detailed")
.replace("{no-permission-msg}", noPerm)
.replace("{permission}", "playerbountiesplus.command.bounty.set");
sender.sendMessage(noPermDetailed);
return true;
}
String playerNameArg = args[1];
float amount;
int amount;
try {
amount = Integer.parseInt(args[2]);
} catch (NumberFormatException ex) {
@@ -76,18 +61,7 @@ public class BountySetCmd {
}
// Apply bounty multiplier
amount *= (float) plugin.getConfig().getDouble("bounty-multiplier", 1.0);
// Trigger bounty set event
BountySetEvent event = new BountySetEvent(sender instanceof Player ? (Player) sender : null, target, amount);
plugin.getServer().getPluginManager().callEvent(event);
amount = event.getAmount();
// Check if event was cancelled
if (event.isCancelled()) {
sender.sendMessage(plugin.getLang().getColored("command.bounty.set.cancelled"));
return true;
}
amount *= plugin.getConfig().getDouble("bounty-multiplier", 1.0);
// Sanity check final amount
if (amount <= 0) {
@@ -98,10 +72,10 @@ public class BountySetCmd {
UUID playerUUID = target.getUniqueId();
// Calculate total bounty including previous bounties
BountyDataManager bountyDataManager = plugin.getBountyDataManager();
int bountyAlreadyPresent = bountyDataManager.getBounty(playerUUID);
int totalBounty = ((int) amount) + bountyAlreadyPresent;
bountyDataManager.setBounty(playerUUID, totalBounty);
ConcurrentHashMap<UUID, Integer> bounties = plugin.getBountyDataManager().getBounties();
Integer bountyAlreadyPresent = bounties.getOrDefault(playerUUID, 0);
int totalBounty = amount + bountyAlreadyPresent;
bounties.put(playerUUID, totalBounty);
// Confirmation
sender.sendMessage(
@@ -130,23 +104,8 @@ public class BountySetCmd {
);
}
bountyDataManager.saveBountiesAsync();
plugin.getBountyDataManager().saveBountiesAsync();
return true;
}
@Nullable
public static List<String> onTabComplete(@NotNull CommandSender sender, @NotNull String[] args) {
if (args.length == 2) {
// Suggest online player names for the username
return sender.getServer().getOnlinePlayers().stream()
.map(Player::getName)
.filter(name -> name.toLowerCase().startsWith(args[1].toLowerCase()))
.collect(Collectors.toList());
} else if (args.length == 3) {
// Suggest a placeholder for the amount
return Collections.singletonList("<amount>");
}
return Collections.emptyList();
}
}
@@ -1,57 +0,0 @@
package com.tcoded.playerbountiesplus.event;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class BountyClaimEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final Player claimant;
private final Player victim;
private final double amount;
private boolean cancelled;
public BountyClaimEvent(@NotNull Player claimant, @NotNull Player victim, double amount) {
this.claimant = claimant;
this.victim = victim;
this.amount = amount;
this.cancelled = false;
}
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancel) {
this.cancelled = cancel;
}
public Player getClaimant() {
return claimant;
}
public Player getVictim() {
return victim;
}
public double getAmount() {
return amount;
}
@Override
public @NotNull HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}
@@ -1,64 +0,0 @@
package com.tcoded.playerbountiesplus.event;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class BountySetEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final Player setter;
private final Player target;
private float amount;
private boolean cancelled;
public BountySetEvent(Player setter, @NotNull Player target, float amount) {
this.setter = setter;
this.target = target;
this.amount = amount;
this.cancelled = false;
}
/**
* @return The player who set the bounty or null if it's set by console/command block.
*/
public Player getSetter() {
return setter;
}
public Player getTarget() {
return target;
}
public float getAmount() {
return amount;
}
public void setAmount(float amount) {
this.amount = amount;
}
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancel) {
this.cancelled = cancel;
}
@Override
public @NotNull HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}
@@ -1,14 +0,0 @@
package com.tcoded.playerbountiesplus.gui;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.InventoryHolder;
public interface IPbpGui extends InventoryHolder {
void open();
void setContents();
void handleClick(InventoryClickEvent event);
}
@@ -1,50 +0,0 @@
package com.tcoded.playerbountiesplus.gui;
import com.tcoded.playerbountiesplus.PlayerBountiesPlus;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory;
public class MainBountyGui implements IPbpGui {
private final PlayerBountiesPlus plugin;
private final Player viewer;
private final Inventory inventory;
public MainBountyGui(PlayerBountiesPlus plugin, Player viewer) {
this.plugin = plugin;
this.viewer = viewer;
// Create inventory
this.inventory = Bukkit.createInventory(
this,
9 * 3,
plugin.getLang().getColored("gui.main.title")
);
}
@Override
public Inventory getInventory() {
return this.inventory;
}
@Override
public void open() {
setContents();
// Open the inventory for the viewer
viewer.openInventory(this.inventory);
}
@Override
public void setContents() {
// TODO: Populate the inventory
}
@Override
public void handleClick(InventoryClickEvent event) {
// TODO: Handle inventory clicks
}
}
@@ -0,0 +1,42 @@
package com.tcoded.playerbountiesplus.hook;
import com.tcoded.playerbountiesplus.PlayerBountiesPlus;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.OfflinePlayer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.text.DecimalFormat;
import java.util.UUID;
public class PAPIExpansion extends PlaceholderExpansion {
private static final String IDENTIFIER = "playerbountiesplus";
private final PlayerBountiesPlus plugin;
public PAPIExpansion(PlayerBountiesPlus plugin) {
this.plugin = plugin;
}
public @NotNull String getIdentifier() {
return IDENTIFIER;
}
public @NotNull String getAuthor() {
return plugin.getDescription().getAuthors().toString();
}
public @NotNull String getVersion() {
return plugin.getDescription().getVersion();
}
public @Nullable String onRequest(OfflinePlayer player, @NotNull String params) {
if (params.equals("bounty")) {
UUID uuid = player.getUniqueId();
return String.valueOf(plugin.getBountyDataManager().getBounties().getOrDefault(uuid, 0));
}
return null;
}
}
@@ -0,0 +1,15 @@
package com.tcoded.playerbountiesplus.hook.currency;
import org.bukkit.entity.Player;
public abstract class AbstractEconomyHook {
public abstract boolean isValid();
public abstract void giveEco(Player player, double amount);
public abstract boolean takeEco(Player player, double amount);
public abstract boolean takeEco(Player player, double amount, boolean force);
}
@@ -2,7 +2,7 @@ package com.tcoded.playerbountiesplus.hook.currency;
import org.bukkit.entity.Player;
public class DummyEcoHook implements EconomyHook {
public class DummyEcoHook extends AbstractEconomyHook {
@Override
public boolean isValid() {
@@ -1,15 +0,0 @@
package com.tcoded.playerbountiesplus.hook.currency;
import org.bukkit.entity.Player;
public interface EconomyHook {
boolean isValid();
void giveEco(Player player, double amount);
boolean takeEco(Player player, double amount);
boolean takeEco(Player player, double amount, boolean force);
}
@@ -6,7 +6,7 @@ import net.milkbowl.vault.economy.EconomyResponse;
import org.bukkit.entity.Player;
import org.bukkit.plugin.RegisteredServiceProvider;
public class VaultHook implements EconomyHook {
public class VaultHook extends AbstractEconomyHook {
private final PlayerBountiesPlus plugin;
@@ -1,15 +0,0 @@
package com.tcoded.playerbountiesplus.hook.placeholder;
public class DummyPlaceholderHook implements PlaceholderHook {
@Override
public void enable() {
}
@Override
public void disable() {
}
}
@@ -1,63 +0,0 @@
package com.tcoded.playerbountiesplus.hook.placeholder;
import com.tcoded.playerbountiesplus.PlayerBountiesPlus;
import me.clip.placeholderapi.PlaceholderAPIPlugin;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.OfflinePlayer;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class PlaceholderAPIHook extends PlaceholderExpansion implements PlaceholderHook {
private final PlayerBountiesPlus pbpPlugin;
public PlaceholderAPIHook(PlayerBountiesPlus pbpPlugin, Plugin papiPlugin) {
this.pbpPlugin = pbpPlugin;
if (!(papiPlugin instanceof PlaceholderAPIPlugin)) {
throw new IllegalArgumentException("Plugin is not PlaceholderAPI");
}
}
@Override
public @NotNull String getIdentifier() {
return pbpPlugin.getName().toLowerCase();
}
@Override
public @NotNull String getAuthor() {
return pbpPlugin.getDescription().getAuthors().get(0);
}
@Override
public @NotNull String getVersion() {
return pbpPlugin.getDescription().getVersion();
}
@Override
public boolean persist() {
return true;
}
@Override
public void enable() {
this.register();
}
@Override
public void disable() {
this.unregister();
}
@Override
public @Nullable String onRequest(OfflinePlayer player, @NotNull String params) {
if (params.equals("bounty")) {
return String.valueOf(pbpPlugin.getBountyDataManager().getBounty(player.getUniqueId()));
} else if (params.equals("hasbounty")) {
return String.valueOf(pbpPlugin.getBountyDataManager().hasBounty(player.getUniqueId()));
}
return "INVALID-OPTION";
}
}
@@ -1,27 +0,0 @@
package com.tcoded.playerbountiesplus.hook.placeholder;
import com.tcoded.playerbountiesplus.PlayerBountiesPlus;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.jetbrains.annotations.NotNull;
public interface PlaceholderHook {
@NotNull
static PlaceholderHook findPlaceholderHook(PlayerBountiesPlus plugin) {
PluginManager pluginManager = plugin.getServer().getPluginManager();
Plugin papiPlugin = pluginManager.getPlugin("PlaceholderAPI");
if (papiPlugin != null) {
return new PlaceholderAPIHook(plugin, papiPlugin);
}
plugin.getLogger().warning("PlaceholderAPI not found, placeholders will be unavailable.");
return new DummyPlaceholderHook();
}
void enable();
void disable();
}
@@ -1,12 +1,14 @@
package com.tcoded.playerbountiesplus.hook.team;
import com.tcoded.playerbountiesplus.PlayerBountiesPlus;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.List;
public abstract class AbstractTeamHook implements TeamHook {
public abstract class AbstractTeamHook {
protected PlayerBountiesPlus plugin;
protected JavaPlugin teamPlugin;
@@ -16,23 +18,66 @@ public abstract class AbstractTeamHook implements TeamHook {
this.teamPlugin = (JavaPlugin) teamPlugin;
}
@Override
public static AbstractTeamHook findTeamHook(PlayerBountiesPlus plugin) {
PluginManager pluginManager = plugin.getServer().getPluginManager();
// loving11ish - ClansLite - https://www.spigotmc.org/resources/clanslite-1-19-4-support.97163/
Plugin clansLitePlugin = pluginManager.getPlugin("ClansLite");
if (clansLitePlugin != null && clansLitePlugin.isEnabled()) {
return new ClansLiteHook(plugin, clansLitePlugin);
}
// AlessioDP - Parties - https://www.spigotmc.org/resources/parties-an-advanced-parties-manager.3709/
Plugin partiesPlugin = pluginManager.getPlugin("Parties");
if (partiesPlugin != null && partiesPlugin.isEnabled()) {
return new AlessioPartiesHook(plugin, partiesPlugin);
}
// booksaw - BetterTeams - https://www.spigotmc.org/resources/better-teams.17129/
Plugin betterTeamsPlugin = pluginManager.getPlugin("BetterTeams");
if (betterTeamsPlugin != null && betterTeamsPlugin.isEnabled()) {
return new BetterTeamsHook(plugin, betterTeamsPlugin);
}
// RoinujNosde - SimpleClans - https://www.spigotmc.org/resources/simpleclans.71242/
Plugin simpleClansPlugin = pluginManager.getPlugin("SimpleClans");
if (simpleClansPlugin != null && simpleClansPlugin.isEnabled()) {
return new SimpleClansHook(plugin, simpleClansPlugin);
}
// SaberLLC - Factions (SaberFactions) - https://www.spigotmc.org/resources/simpleclans.71242/
Plugin saberFactionsPlugin = pluginManager.getPlugin("Factions");
if (saberFactionsPlugin != null &&
saberFactionsPlugin.getDescription().getMain().equals("com.massivecraft.factions.FactionsPlugin") &&
saberFactionsPlugin.isEnabled()) {
return new SaberFactionsHook(plugin, saberFactionsPlugin);
}
// LlmDl - Towny - https://www.spigotmc.org/resources/towny-advanced.72694/
Plugin townyPlugin = pluginManager.getPlugin("Towny");
if (townyPlugin != null && townyPlugin.isEnabled()) {
return new TownyHook(plugin, simpleClansPlugin);
}
return null;
}
public String getPluginName() {
return this.teamPlugin.getName();
}
@Override
public String getAuthor() {
List<String> authors = this.teamPlugin.getDescription().getAuthors();
if (authors.isEmpty()) return "N/A";
return authors.get(0);
}
@Override
public String[] getAuthors() {
List<String> authors = this.teamPlugin.getDescription().getAuthors();
if (authors.isEmpty()) return new String[0];
return authors.toArray(new String[0]);
}
public abstract boolean isFriendly(Player player1, Player player2);
}
@@ -5,8 +5,6 @@ import com.tcoded.playerbountiesplus.PlayerBountiesPlus;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import java.util.UUID;
public class AlessioPartiesHook extends AbstractTeamHook {
public AlessioPartiesHook(PlayerBountiesPlus plugin, Plugin partiesPlugin) {
@@ -15,12 +13,6 @@ public class AlessioPartiesHook extends AbstractTeamHook {
@Override
public boolean isFriendly(Player player1, Player player2) {
UUID uuid1 = player1.getUniqueId();
UUID uuid2 = player2.getUniqueId();
if (!Parties.getApi().isPlayerInParty(uuid1)) return false;
if (!Parties.getApi().isPlayerInParty(uuid2)) return false;
return Parties.getApi().areInTheSameParty(uuid1, uuid2);
return Parties.getApi().areInTheSameParty(player1.getUniqueId(), player2.getUniqueId());
}
}
@@ -13,9 +13,6 @@ public class BetterTeamsHook extends AbstractTeamHook {
@Override
public boolean isFriendly(Player player1, Player player2) {
if (Team.getTeam(player1) == null) return false;
if (Team.getTeam(player2) == null) return false;
return Team.getTeam(player1) == Team.getTeam(player2);
}
@@ -23,12 +23,7 @@ public class ClansLiteHook extends AbstractTeamHook {
@Override
public boolean isFriendly(Player player1, Player player2) {
String clanId1 = this.getClanId(player1);
String clanId2 = this.getClanId(player2);
if (clanId1 == null) return false;
if (clanId2 == null) return false;
return clanId1.equals(this.getClanId(player2));
String clanIdVictim = this.getClanId(player1);
return clanIdVictim != null && clanIdVictim.equals(this.getClanId(player2));
}
}
@@ -14,13 +14,8 @@ public class SaberFactionsHook extends AbstractTeamHook {
@Override
public boolean isFriendly(Player player1, Player player2) {
FPlayers fPlayers = FPlayers.getInstance();
String factionId1 = fPlayers.getByPlayer(player1).getFactionId();
String factionId2 = fPlayers.getByPlayer(player2).getFactionId();
if (factionId1 == null) return false;
if (factionId2 == null) return false;
return factionId1.equals(factionId2);
}
@@ -1,14 +1,11 @@
package com.tcoded.playerbountiesplus.hook.team;
import com.tcoded.playerbountiesplus.PlayerBountiesPlus;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.managers.ClanManager;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import java.util.UUID;
public class SimpleClansHook extends AbstractTeamHook {
public SimpleClansHook(PlayerBountiesPlus plugin, Plugin teamPlugin) {
@@ -18,17 +15,7 @@ public class SimpleClansHook extends AbstractTeamHook {
@Override
public boolean isFriendly(Player player1, Player player2) {
ClanManager clanManager = SimpleClans.getInstance().getClanManager();
UUID uuid1 = player1.getUniqueId();
UUID uuid2 = player2.getUniqueId();
Clan clan1 = clanManager.getClanByPlayerUniqueId(uuid1);
Clan clan2 = clanManager.getClanByPlayerUniqueId(uuid2);
if (clan1 == null) return false;
if (clan2 == null) return false;
return clan1 == clan2;
return clanManager.getClanByPlayerUniqueId(player1.getUniqueId()) == clanManager.getClanByPlayerUniqueId(player2.getUniqueId());
}
}
@@ -1,62 +0,0 @@
package com.tcoded.playerbountiesplus.hook.team;
import com.tcoded.playerbountiesplus.PlayerBountiesPlus;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
public interface TeamHook {
static AbstractTeamHook findTeamHook(PlayerBountiesPlus plugin) {
PluginManager pluginManager = plugin.getServer().getPluginManager();
// loving11ish - ClansLite - https://www.spigotmc.org/resources/clanslite-1-19-4-support.97163/
Plugin clansLitePlugin = pluginManager.getPlugin("ClansLite");
if (clansLitePlugin != null && clansLitePlugin.isEnabled()) {
return new ClansLiteHook(plugin, clansLitePlugin);
}
// AlessioDP - Parties - https://www.spigotmc.org/resources/parties-an-advanced-parties-manager.3709/
Plugin partiesPlugin = pluginManager.getPlugin("Parties");
if (partiesPlugin != null && partiesPlugin.isEnabled()) {
return new AlessioPartiesHook(plugin, partiesPlugin);
}
// booksaw - BetterTeams - https://www.spigotmc.org/resources/better-teams.17129/
Plugin betterTeamsPlugin = pluginManager.getPlugin("BetterTeams");
if (betterTeamsPlugin != null && betterTeamsPlugin.isEnabled()) {
return new BetterTeamsHook(plugin, betterTeamsPlugin);
}
// RoinujNosde - SimpleClans - https://www.spigotmc.org/resources/simpleclans.71242/
Plugin simpleClansPlugin = pluginManager.getPlugin("SimpleClans");
if (simpleClansPlugin != null && simpleClansPlugin.isEnabled()) {
return new SimpleClansHook(plugin, simpleClansPlugin);
}
// SaberLLC - Factions (SaberFactions) - https://www.spigotmc.org/resources/simpleclans.71242/
Plugin saberFactionsPlugin = pluginManager.getPlugin("Factions");
if (saberFactionsPlugin != null &&
saberFactionsPlugin.getDescription().getMain().equals("com.massivecraft.factions.FactionsPlugin") &&
saberFactionsPlugin.isEnabled()) {
return new SaberFactionsHook(plugin, saberFactionsPlugin);
}
// LlmDl - Towny - https://www.spigotmc.org/resources/towny-advanced.72694/
Plugin townyPlugin = pluginManager.getPlugin("Towny");
if (townyPlugin != null && townyPlugin.isEnabled()) {
return new TownyHook(plugin, simpleClansPlugin);
}
return null;
}
String getPluginName();
String getAuthor();
String[] getAuthors();
boolean isFriendly(Player player1, Player player2);
}
@@ -23,14 +23,11 @@ public class TownyHook extends AbstractTeamHook {
@Override
public boolean isFriendly(Player player1, Player player2) {
Town town1 = getTown(player1);
Town town2 = getTown(player2);
Nation nation1 = getNation(player1);
Nation nation2 = getNation(player2);
boolean sameTown = town1 != null && town2 != null && (town1.hasResident(player2) || town1.hasAlly(town2));
boolean sameNation = nation1 != null && nation2 != null && (nation1.equals(nation2) || nation1.hasAlly(nation2));
Town town = getTown(player1);
Nation player1Nation = getNation(player1);
Nation player2Nation = getNation(player2);
boolean sameTown = town != null && town.hasResident(player2);
boolean sameNation = player1Nation != null && player1Nation.equals(player2Nation);
return sameTown || sameNation;
}
@@ -1,9 +1,7 @@
package com.tcoded.playerbountiesplus.listener;
import com.tcoded.playerbountiesplus.PlayerBountiesPlus;
import com.tcoded.playerbountiesplus.event.BountyClaimEvent;
import com.tcoded.playerbountiesplus.hook.team.TeamHook;
import com.tcoded.playerbountiesplus.manager.BountyDataManager;
import com.tcoded.playerbountiesplus.hook.team.AbstractTeamHook;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -11,10 +9,11 @@ import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
public class DeathListener implements Listener {
private final PlayerBountiesPlus plugin;
private PlayerBountiesPlus plugin;
public DeathListener(PlayerBountiesPlus plugin) {
this.plugin = plugin;
@@ -26,37 +25,22 @@ public class DeathListener implements Listener {
Player killer = victim.getKiller();
if (killer != null) {
if (!killer.hasPermission("playerbountiesplus.event.claim")) {
killer.sendMessage(plugin.getLang().getColored("death.no-permission"));
return;
}
BountyDataManager bountyDataManager = this.plugin.getBountyDataManager();
ConcurrentHashMap<UUID, Integer> bounties = this.plugin.getBountyDataManager().getBounties();
UUID victimId = victim.getUniqueId();
Integer bounty = bounties.get(victimId);
// Bounty check
if (!bountyDataManager.hasBounty(victimId)) {
if (bounty == null || bounty == 0) {
return;
}
int bounty = bountyDataManager.getBounty(victimId);
// Clan check
TeamHook teamHook = this.plugin.getTeamHook();
AbstractTeamHook teamHook = this.plugin.getTeamHook();
if (teamHook != null && teamHook.isFriendly(killer, victim)) {
killer.sendMessage(plugin.getLang().getColored("death.same-team"));
return;
}
// Trigger Bounty Claimed Event
BountyClaimEvent claimEvent = new BountyClaimEvent(killer, victim, bounty);
this.plugin.getServer().getPluginManager().callEvent(claimEvent);
// Check if event is cancelled
if (claimEvent.isCancelled()) {
return;
}
// Give reward!
if (plugin.getConfig().getBoolean("bounty-claimable", true)) {
double claimMultiplier = plugin.getConfig().getDouble("bounty-claim-multiplier", 1.0);
@@ -80,13 +64,13 @@ public class DeathListener implements Listener {
plugin.getLang().getColored("death.announce-claimed")
.replace("{killer}", killer.getName())
.replace("{victim}", victim.getName())
.replace("{bounty}", String.valueOf(bounty))
.replace("{bounty}", bounty.toString())
);
}
// Remove bounty
bountyDataManager.removeBounty(victimId);
bountyDataManager.saveBountiesAsync();
bounties.remove(victimId);
this.plugin.getBountyDataManager().saveBountiesAsync();
}
}
@@ -1,28 +0,0 @@
package com.tcoded.playerbountiesplus.listener;
import com.tcoded.playerbountiesplus.gui.IPbpGui;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.InventoryHolder;
public class GuiListener implements Listener {
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
// Get the inventory holder
InventoryHolder holder = event.getView().getTopInventory().getHolder();
// Ensure the holder is a GUI
if (!(holder instanceof IPbpGui gui)) {
return;
}
// Cancel normal click behaviour
event.setCancelled(true);
// Delegate the click handling
gui.handleClick(event);
}
}
@@ -50,22 +50,6 @@ public class BountyDataManager {
return this.bounties;
}
public boolean hasBounty(UUID player) {
return this.bounties.containsKey(player) && this.bounties.get(player) > 0;
}
public void setBounty(UUID player, int amount) {
this.bounties.put(player, amount);
}
public int getBounty(UUID player) {
return this.bounties.getOrDefault(player, 0);
}
public void removeBounty(UUID player) {
this.bounties.remove(player);
}
public void saveBounties() {
synchronized (this.savingFileLock) {
// Clear existing
@@ -99,7 +83,7 @@ public class BountyDataManager {
}
// Save
this.plugin.getFoliaLib().getScheduler().runAsync(wt -> {
this.plugin.getFoliaLib().getImpl().runAsync(() -> {
this.saveBounties();
this.savingAsync.set(false);
@@ -108,5 +92,4 @@ public class BountyDataManager {
}
});
}
}
-25
View File
@@ -1,7 +1,6 @@
death:
same-team: "&aDer Spieler, den du getötet hast, hat eine aktive Belohnung, aber du bist im selben Team wie er!"
announce-claimed: "&4&l{killer} hat die Belohnung von {victim} im Wert von ${bounty} beansprucht"
no-permission: "&cSie dürfen keine Kopfgelder beanspruchen!"
command:
no-permission: "&cDu hast keine Berechtigung, diesen Befehl zu verwenden!"
@@ -11,30 +10,6 @@ command:
reloaded: "&aDie Konfigurationsdateien wurden erfolgreich neu geladen!"
version:
no-permission: "&7(Version nicht sichtbar: Fehlende Berechtigung)"
bounty:
set:
missing-args: "&cBenutzung: /pbp bounty set <Spieler> <Betrag>"
amount-nan: "&cDas ist keine gültige Zahl!"
player-not-found: "&cDieser Spieler ist nicht online oder existiert nicht!"
success: "&aBelohnung für {target} auf {bounty} gesetzt."
add:
missing-args: "&cBenutzung: /pbp bounty add <Spieler> <Betrag>"
amount-nan: "&cDas ist keine gültige Zahl!"
player-not-found: "&cDieser Spieler ist nicht online oder existiert nicht!"
success: "&a{amount} zur Belohnung von {target} hinzugefügt. Gesamt: {total}."
remove:
missing-args: "&cBenutzung: /pbp bounty remove <Spieler> <Betrag>"
amount-nan: "&cDas ist keine gültige Zahl!"
player-not-found: "&cDieser Spieler ist nicht online oder existiert nicht!"
success: "&a{amount} von der Belohnung von {target} entfernt. Gesamt: {total}."
delete:
missing-args: "&cBenutzung: /pbp bounty delete <Spieler>"
player-not-found: "&cDieser Spieler ist nicht online oder existiert nicht!"
success: "&aBelohnung für {target} gelöscht."
get:
missing-args: "&cBenutzung: /pbp bounty get <Spieler>"
player-not-found: "&cDieser Spieler ist nicht online oder existiert nicht!"
success: "&a{target} hat derzeit eine Belohnung von {bounty}."
bounty:
no-action: "&cDu musst eine Aktion angeben! /bounty <set/top/check>"
invalid-action: "&cDas ist keine gültige Aktion!"
+1 -26
View File
@@ -1,7 +1,6 @@
death:
same-team: "&aThe player you killed has an active bounty but you are in the same team as they are!"
announce-claimed: "&4&l{killer} claimed {victim}'s bounty worth ${bounty}"
no-permission: "&cYou are not allowed to claim bounties!"
command:
no-permission: "&cYou don't have the permission to use this command!"
@@ -11,30 +10,6 @@ command:
reloaded: "&aSuccessfully reloaded the configuration files!"
version:
no-permission: "&7(Version not visible: Missing permission)"
bounty:
set:
missing-args: "&cUsage: /pbp bounty set <player> <amount>"
amount-nan: "&cThat's not a valid number!"
player-not-found: "&cThat player is not online or doesn't exist!"
success: "&aSet {target}'s bounty to {bounty}."
add:
missing-args: "&cUsage: /pbp bounty add <player> <amount>"
amount-nan: "&cThat's not a valid number!"
player-not-found: "&cThat player is not online or doesn't exist!"
success: "&aAdded {amount} bounty to {target}. Total: {total}."
remove:
missing-args: "&cUsage: /pbp bounty remove <player> <amount>"
amount-nan: "&cThat's not a valid number!"
player-not-found: "&cThat player is not online or doesn't exist!"
success: "&aRemoved {amount} bounty from {target}. Total: {total}."
delete:
missing-args: "&cUsage: /pbp bounty delete <player>"
player-not-found: "&cThat player is not online or doesn't exist!"
success: "&aDeleted bounty for {target}."
get:
missing-args: "&cUsage: /pbp bounty get <player>"
player-not-found: "&cThat player is not online or doesn't exist!"
success: "&a{target} currently has a bounty of {bounty}."
bounty:
no-action: "&cYou need to specify an action! /bounty <set/top/check>"
invalid-action: "&cThat's not a valid action!"
@@ -56,4 +31,4 @@ command:
bounty-found: "&aThere is a bounty worth {bounty} on {target}'s head!"
top:
top-10: "&eTop 10 bounties:"
no-bounties: "&r &cNo bounties were set!"
no-bounties: "&r &cNo bounties were set!"
+1 -31
View File
@@ -1,7 +1,6 @@
death:
same-team: "&aThe player you killed has an active bounty but you are in the same team as they are!"
announce-claimed: "&4&l{killer} claimed {victim}'s bounty worth ${bounty}"
no-permission: "&cYou are not allowed to claim bounties!"
command:
no-permission: "&cYou don't have the permission to use this command!"
@@ -11,30 +10,6 @@ command:
reloaded: "&aSuccessfully reloaded the configuration files!"
version:
no-permission: "&7(Version not visible: Missing permission)"
bounty:
set:
missing-args: "&cUsage: /pbp bounty set <player> <amount>"
amount-nan: "&cThat's not a valid number!"
player-not-found: "&cThat player is not online or doesn't exist!"
success: "&aSet {target}'s bounty to {bounty}."
add:
missing-args: "&cUsage: /pbp bounty add <player> <amount>"
amount-nan: "&cThat's not a valid number!"
player-not-found: "&cThat player is not online or doesn't exist!"
success: "&aAdded {amount} bounty to {target}. Total: {total}."
remove:
missing-args: "&cUsage: /pbp bounty remove <player> <amount>"
amount-nan: "&cThat's not a valid number!"
player-not-found: "&cThat player is not online or doesn't exist!"
success: "&aRemoved {amount} bounty from {target}. Total: {total}."
delete:
missing-args: "&cUsage: /pbp bounty delete <player>"
player-not-found: "&cThat player is not online or doesn't exist!"
success: "&aDeleted bounty for {target}."
get:
missing-args: "&cUsage: /pbp bounty get <player>"
player-not-found: "&cThat player is not online or doesn't exist!"
success: "&a{target} currently has a bounty of {bounty}."
bounty:
no-action: "&cYou need to specify an action! /bounty <set/top/check>"
invalid-action: "&cThat's not a valid action!"
@@ -56,9 +31,4 @@ command:
bounty-found: "&aThere is a bounty worth {bounty} on {target}'s head!"
top:
top-10: "&eTop 10 bounties:"
no-bounties: "&r &cNo bounties were set!"
gui:
main:
title: "&eBounties"
no-bounties: "&r &cNo bounties were set!"
-1
View File
@@ -1,7 +1,6 @@
death:
same-team: "&aDa pwayer you kiwwed has an active bounty but you awe in da same team as they awe!"
announce-claimed: "&4&w{killer} cwaimed {victim}'s bounty wowth ${bounty}"
no-permission: "&cYou awe nyot awwowed to cwaim bounties!"
command:
no-permission: "&cYou don't have da pewmission to use this command!"
+3 -28
View File
@@ -1,40 +1,15 @@
death:
same-team: "&aEl jugador que mataste tiene una recompensa activa pero estás en el mismo equipo que él."
announce-claimed: "&4&l{killer} reclamó la recompensa de {victim} valorada en ${bounty}"
no-permission: "&c¡No se le permite reclamar recompensas!"
command:
no-permission: "&cNo tienes permiso para usar este comando."
no-permission-detailed: "{no-permission-msg} &7({permission})"
admin:
reload:
reloaded: "&a¡Archivos de configuración recargados con éxito!"
reloaded: "&aLos archivos de configuración se han recargado con éxito."
version:
no-permission: "&7(Versión no visible: Falta permiso)"
bounty:
set:
missing-args: "&cUso: /pbp bounty set <jugador> <cantidad>"
amount-nan: "&c¡Ese no es un número válido!"
player-not-found: "&c¡Ese jugador no está en línea o no existe!"
success: "&aSe ha establecido la recompensa de {target} en {bounty}."
add:
missing-args: "&cUso: /pbp bounty add <jugador> <cantidad>"
amount-nan: "&c¡Ese no es un número válido!"
player-not-found: "&c¡Ese jugador no está en línea o no existe!"
success: "&aSe ha añadido una recompensa de {amount} a {target}. Total: {total}."
remove:
missing-args: "&cUso: /pbp bounty remove <jugador> <cantidad>"
amount-nan: "&c¡Ese no es un número válido!"
player-not-found: "&c¡Ese jugador no está en línea o no existe!"
success: "&aSe ha eliminado una recompensa de {amount} de {target}. Total: {total}."
delete:
missing-args: "&cUso: /pbp bounty delete <jugador>"
player-not-found: "&c¡Ese jugador no está en línea o no existe!"
success: "&aRecompensa eliminada para {target}."
get:
missing-args: "&cUso: /pbp bounty get <jugador>"
player-not-found: "&c¡Ese jugador no está en línea o no existe!"
success: "&a{target} actualmente tiene una recompensa de {bounty}."
no-permission: "&7(Versión no visible: Permiso faltante)"
bounty:
no-action: "&cDebes especificar una acción! /bounty <set/top/check>"
invalid-action: "&cEsa no es una acción válida."
@@ -56,4 +31,4 @@ command:
bounty-found: "&aHay una recompensa valorada en {bounty} en la cabeza de {target}."
top:
top-10: "&eLos 10 mejores recompensas:"
no-bounties: "&r &cNo se han establecido recompensas."
no-bounties: "&r &cNo se han establecido recompensas."
+1 -40
View File
@@ -1,7 +1,6 @@
death:
same-team: "&aLe joueur que vous avez tué a une prime sur sa tête mais vous êtes dans la même équipe!"
announce-claimed: "&4&l{killer} a gagné la prime de {victim} au prix de ${bounty}"
no-permission: "&cVous n'êtes pas autorisé à réclamer des primes!"
command:
no-permission: "&cVous n'avez pas la permission d'utiliser cette commande!"
@@ -11,30 +10,6 @@ command:
reloaded: "&aLes fichiers de configuration ont été mis à jour avec succès!"
version:
no-permission: "&7(Version non visible: Permission manquante)"
bounty:
set:
missing-args: "&cUtilisation : /pbp bounty set <joueur> <montant>"
amount-nan: "&cCe n'est pas un nombre valide !"
player-not-found: "&cCe joueur n'est pas en ligne ou n'existe pas !"
success: "&aPrime de {target} définie à {bounty}."
add:
missing-args: "&cUtilisation : /pbp bounty add <joueur> <montant>"
amount-nan: "&cCe n'est pas un nombre valide !"
player-not-found: "&cCe joueur n'est pas en ligne ou n'existe pas !"
success: "&aAjouté {amount} de prime à {target}. Total : {total}."
remove:
missing-args: "&cUtilisation : /pbp bounty remove <joueur> <montant>"
amount-nan: "&cCe n'est pas un nombre valide !"
player-not-found: "&cCe joueur n'est pas en ligne ou n'existe pas !"
success: "&aRetiré {amount} de la prime de {target}. Total : {total}."
delete:
missing-args: "&cUtilisation : /pbp bounty delete <joueur>"
player-not-found: "&cCe joueur n'est pas en ligne ou n'existe pas !"
success: "&aPrime supprimée pour {target}."
get:
missing-args: "&cUtilisation : /pbp bounty get <joueur>"
player-not-found: "&cCe joueur n'est pas en ligne ou n'existe pas !"
success: "&a{target} a actuellement une prime de {bounty}."
bounty:
no-action: "&cVous devez spécifier une action! /bounty <set/top/check>"
invalid-action: "&cCeci n'est pas une action valable!"
@@ -49,20 +24,6 @@ command:
success: "&cVous avez placé une prime de {bounty} sur la tête de {target}!"
announce: "\nUne prime de {bounty} a été placée sur la tête de {target} par {player}!{extra}\n"
announce-extra: " (Total: {total})"
add:
missing-args: "&cUtilisation : /pbp bounty add <joueur> <montant>"
amount-nan: "&cCe n'est pas un nombre valide !"
player-not-found: "&cCe joueur n'est pas en ligne ou n'existe pas !"
success: "&aAjouté {amount} de prime à {target}. Total : {total}."
remove:
missing-args: "&cUtilisation : /pbp bounty remove <joueur> <montant>"
amount-nan: "&cCe n'est pas un nombre valide !"
player-not-found: "&cCe joueur n'est pas en ligne ou n'existe pas !"
success: "&aRetiré {amount} de la prime de {target}. Total : {total}."
delete:
missing-args: "&cUtilisation : /pbp bounty delete <joueur>"
player-not-found: "&cCe joueur n'est pas en ligne ou n'existe pas !"
success: "&aPrime supprimée pour {target}."
check:
no-player-specified: "&cVous devez spécifier un joueur! /bounty check <player>"
player-not-found: "&cCe joueur n'est pas en ligne ou n'existe pas"
@@ -70,4 +31,4 @@ command:
bounty-found: "&aIl y a une prime de {bounty} sur la tête de {target}!"
top:
top-10: "&eLes top 10 primes:"
no-bounties: "&r &cAucune prime n'a été placée!"
no-bounties: "&r &cAucune prime n'a été placée!"
-1
View File
@@ -1,7 +1,6 @@
death:
same-team: "&aवह खिलाड़ी जिसे आपने मार डाला है, उसके पास एक सक्रिय इनाम है, लेकिन आप उनकी टीम में हैं!"
announce-claimed: "&4&l{killer} ने {victim} के इनाम {bounty} को मांग लिया"
no-permission: "&cआपको इनामों का दावा करने की अनुमति नहीं है!"
command:
no-permission: "&cआपके पास इस कमांड का उपयोग करने की अनुमति नहीं है!"
-1
View File
@@ -5,7 +5,6 @@
death:
same-team: "&aA játékos, akit megöltél, aktív fejpénzt volt a fején, de ugyanabba a csapatba tartozol, mint ő!"
announce-claimed: "&4&l{killer} behajtotta {victim} fejpénzét és megkapta jutalmát aminek értéke: ${bounty}"
no-permission: "&cNem igényelheted a fejpénzeket!"
command:
no-permission: "&cNincs jogosultságod ennek a parancsnak a használatához!"
-25
View File
@@ -1,7 +1,6 @@
death:
same-team: "&aIl giocatore che hai ucciso ha una taglia attiva, ma sei nella stessa squadra!"
announce-claimed: "&4&l{killer} ha reclamato la taglia di {victim} del valore di ${bounty}"
no-permission: "&cNon ti è permesso riscuotere le taglie!"
command:
no-permission: "&cNon hai il permesso di utilizzare questo comando!"
@@ -11,30 +10,6 @@ command:
reloaded: "&aHai ricaricato con successo i file di configurazione!"
version:
no-permission: "&7(Versione non visibile: Permesso mancante)"
bounty:
set:
missing-args: "&cUso: /pbp bounty set <giocatore> <quantità>"
amount-nan: "&cQuesto non è un numero valido!"
player-not-found: "&cQuesto giocatore non è online o non esiste!"
success: "&aTaglia di {bounty} impostata per {target}."
add:
missing-args: "&cUso: /pbp bounty add <giocatore> <quantità>"
amount-nan: "&cQuesto non è un numero valido!"
player-not-found: "&cQuesto giocatore non è online o non esiste!"
success: "&aAggiunta una taglia di {amount} a {target}. Totale: {total}."
remove:
missing-args: "&cUso: /pbp bounty remove <giocatore> <quantità>"
amount-nan: "&cQuesto non è un numero valido!"
player-not-found: "&cQuesto giocatore non è online o non esiste!"
success: "&aRimossa una taglia di {amount} da {target}. Totale: {total}."
delete:
missing-args: "&cUso: /pbp bounty delete <giocatore>"
player-not-found: "&cQuesto giocatore non è online o non esiste!"
success: "&aTaglia eliminata per {target}."
get:
missing-args: "&cUso: /pbp bounty get <giocatore>"
player-not-found: "&cQuesto giocatore non è online o non esiste!"
success: "&a{target} ha attualmente una taglia di {bounty}."
bounty:
no-action: "&cDevi specificare un'azione! /bounty <set/top/check>"
invalid-action: "&cQuesta non è un'azione valida!"
+2 -27
View File
@@ -1,40 +1,15 @@
death:
same-team: "&aDe speler die je hebt gedood heeft een actieve beloning, maar je zit in hetzelfde team als zij!"
announce-claimed: "&4&l{killer} heeft de beloning van {victim} ter waarde van ${bounty} geclaimd"
no-permission: "&cU mag geen premies claimen!"
command:
no-permission: "&cJe hebt geen toestemming om deze opdracht te gebruiken!"
no-permission-detailed: "{no-permission-msg} &7({permission})"
admin:
reload:
reloaded: "&aConfiguratiebestanden succesvol herladen!"
reloaded: "&aDe configuratiebestanden zijn succesvol herladen!"
version:
no-permission: "&7(Versie niet zichtbaar: Ontbrekend recht)"
bounty:
set:
missing-args: "&cGebruik: /pbp bounty set <speler> <bedrag>"
amount-nan: "&cDat is geen geldig getal!"
player-not-found: "&cDie speler is niet online of bestaat niet!"
success: "&aDe premie van {target} is ingesteld op {bounty}."
add:
missing-args: "&cGebruik: /pbp bounty add <speler> <bedrag>"
amount-nan: "&cDat is geen geldig getal!"
player-not-found: "&cDie speler is niet online of bestaat niet!"
success: "&a{amount} premie toegevoegd aan {target}. Totaal: {total}."
remove:
missing-args: "&cGebruik: /pbp bounty remove <speler> <bedrag>"
amount-nan: "&cDat is geen geldig getal!"
player-not-found: "&cDie speler is niet online of bestaat niet!"
success: "&a{amount} premie verwijderd van {target}. Totaal: {total}."
delete:
missing-args: "&cGebruik: /pbp bounty delete <speler>"
player-not-found: "&cDie speler is niet online of bestaat niet!"
success: "&aPremie verwijderd voor {target}."
get:
missing-args: "&cGebruik: /pbp bounty get <speler>"
player-not-found: "&cDie speler is niet online of bestaat niet!"
success: "&a{target} heeft momenteel een premie van {bounty}."
no-permission: "&7(Versie niet zichtbaar: Ontbrekende toestemming)"
bounty:
no-action: "&cJe moet een actie specificeren! /beloning <zet/hoogte/controle>"
invalid-action: "&cDit is geen geldige actie!"
-25
View File
@@ -1,7 +1,6 @@
death:
same-team: "&aИгрок, которого вы убили, имеет активную награду, но вы находитесь в одной команде с ними!"
announce-claimed: "&4&l{killer} получил награду {victim} на сумму ${bounty}"
no-permission: "&cВам не разрешено требовать наград!"
command:
no-permission: "&cУ вас нет разрешения использовать эту команду!"
@@ -11,30 +10,6 @@ command:
reloaded: "&aКонфигурационные файлы успешно перезагружены!"
version:
no-permission: "&7(Версия не видна: Отсутствует разрешение)"
bounty:
set:
missing-args: "&cИспользование: /pbp bounty set <игрок> <сумма>"
amount-nan: "&cЭто не число!"
player-not-found: "&cЭтот игрок не в сети или не существует!"
success: "&aНаграда {target} установлена на {bounty}."
add:
missing-args: "&cИспользование: /pbp bounty add <игрок> <сумма>"
amount-nan: "&cЭто не число!"
player-not-found: "&cЭтот игрок не в сети или не существует!"
success: "&aДобавлено {amount} к награде {target}. Всего: {total}."
remove:
missing-args: "&cИспользование: /pbp bounty remove <игрок> <сумма>"
amount-nan: "&cЭто не число!"
player-not-found: "&cЭтот игрок не в сети или не существует!"
success: "&aУдалено {amount} из награды {target}. Всего: {total}."
delete:
missing-args: "&cИспользование: /pbp bounty delete <игрок>"
player-not-found: "&cЭтот игрок не в сети или не существует!"
success: "&aНаграда для {target} удалена."
get:
missing-args: "&cИспользование: /pbp bounty get <игрок>"
player-not-found: "&cЭтот игрок не в сети или не существует!"
success: "&aУ {target} сейчас награда {bounty}."
bounty:
no-action: "&cВы должны указать действие! /bounty <set/top/check>"
invalid-action: "&cЭто недопустимое действие!"
-25
View File
@@ -1,7 +1,6 @@
death:
same-team: "&aDen spelare du dödade har en aktiv prissumma, men du tillhör samma lag som de är!"
announce-claimed: "&4&l{killer} har tagit {victim}s prissumma värd {bounty} dollar"
no-permission: "&cDu får inte hämta in prissummor!"
command:
no-permission: "&cDu har inte behörighet att använda detta kommando!"
@@ -11,30 +10,6 @@ command:
reloaded: "&aKonfigurationsfilerna har laddats om framgångsrikt!"
version:
no-permission: "&7(Version ej synlig: Saknad behörighet)"
bounty:
set:
missing-args: "&cAnvändning: /pbp bounty set <spelare> <summa>"
amount-nan: "&cDet är inte ett giltigt nummer!"
player-not-found: "&cDen spelaren är inte online eller existerar inte!"
success: "&aPrissumman för {target} har satts till {bounty}."
add:
missing-args: "&cAnvändning: /pbp bounty add <spelare> <summa>"
amount-nan: "&cDet är inte ett giltigt nummer!"
player-not-found: "&cDen spelaren är inte online eller existerar inte!"
success: "&aLade till {amount} i prissumma för {target}. Totalt: {total}."
remove:
missing-args: "&cAnvändning: /pbp bounty remove <spelare> <summa>"
amount-nan: "&cDet är inte ett giltigt nummer!"
player-not-found: "&cDen spelaren är inte online eller existerar inte!"
success: "&aTog bort {amount} från prissumman för {target}. Totalt: {total}."
delete:
missing-args: "&cAnvändning: /pbp bounty delete <spelare>"
player-not-found: "&cDen spelaren är inte online eller existerar inte!"
success: "&aPrissumman för {target} har tagits bort."
get:
missing-args: "&cAnvändning: /pbp bounty get <spelare>"
player-not-found: "&cDen spelaren är inte online eller existerar inte!"
success: "&a{target} har för närvarande en prissumma på {bounty}."
bounty:
no-action: "&cDu måste ange en åtgärd! /bounty <set/top/check>"
invalid-action: "&cDet är inte en giltig åtgärd!"
-26
View File
@@ -1,7 +1,6 @@
death:
same-team: "&a你击杀的玩家有悬赏,但你与他们在同一队伍中!"
announce-claimed: "&4&l{killer} 已领取 {victim} 的悬赏,价值 ${bounty}"
no-permission: "&c你没有权限领取悬赏!"
command:
no-permission: "&c你没有权限使用此命令!"
@@ -11,30 +10,6 @@ command:
reloaded: "&a成功重新加载配置文件!"
version:
no-permission: "&7(无法查看版本:缺少权限)"
bounty:
set:
missing-args: "&c用法:/pbp bounty set <玩家> <金额>"
amount-nan: "&c这不是一个有效的数字!"
player-not-found: "&c该玩家不在线或不存在!"
success: "&a已将 {target} 的悬赏设置为 {bounty}。"
add:
missing-args: "&c用法:/pbp bounty add <玩家> <金额>"
amount-nan: "&c这不是一个有效的数字!"
player-not-found: "&c该玩家不在线或不存在!"
success: "&a已为 {target} 增加了 {amount} 悬赏。总计:{total}。"
remove:
missing-args: "&c用法:/pbp bounty remove <玩家> <金额>"
amount-nan: "&c这不是一个有效的数字!"
player-not-found: "&c该玩家不在线或不存在!"
success: "&a已为 {target} 移除了 {amount} 悬赏。总计:{total}。"
delete:
missing-args: "&c用法:/pbp bounty delete <玩家>"
player-not-found: "&c该玩家不在线或不存在!"
success: "&a已删除 {target} 的悬赏。"
get:
missing-args: "&c用法:/pbp bounty get <玩家>"
player-not-found: "&c该玩家不在线或不存在!"
success: "&a{target} 当前有一个悬赏,金额为 {bounty}。"
bounty:
no-action: "&c你需要指定一个操作!/bounty <set/top/check>"
invalid-action: "&c这不是一个有效的操作!"
@@ -57,4 +32,3 @@ command:
top:
top-10: "&e前10名悬赏:"
no-bounties: "&r &c没有设置悬赏!"
+6 -13
View File
@@ -15,28 +15,21 @@ softdepend:
- BetterTeams
- SimpleClans
- Towny
- PlaceholderAPI
commands:
bounty:
permission: playerbountiesplus.command.bounty
aliases: [bounties, prime, primes]
playerbountiesplusadmin:
permission: playerbountiesplus.command.admin
aliases: [playerbountiesplus, pbpa, pbp]
permissions:
playerbountiesplus.command.bounty:
default: true
playerbountiesplus.command.admin:
default: op
playerbountiesplus.command.playerbountiesplus:
children:
playerbountiesplus.command.admin.version: {}
playerbountiesplus.command.admin.reload: {}
playerbountiesplus.command.admin.bounty.set: {}
playerbountiesplus.command.admin.bounty.add: {}
playerbountiesplus.command.admin.bounty.remove: {}
playerbountiesplus.command.admin.bounty.delete: {}
playerbountiesplus.command.bounty.set:
default: true
playerbountiesplus.event.claim:
default: true
playerbountiesplus.command.playerbountiesplus.version:
default: true
playerbountiesplus.command.playerbountiesplus.reload:
default: op