Mirror von
https://github.com/TheSilentPro/HeadDB.git
synchronisiert 2024-12-26 19:02:39 +01:00
changes
Dieser Commit ist enthalten in:
Ursprung
d502d8406d
Commit
421757e484
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>tsp.headdb</groupId>
|
<groupId>tsp.headdb</groupId>
|
||||||
<artifactId>HeadDB</artifactId>
|
<artifactId>HeadDB</artifactId>
|
||||||
<version>5.0.0-rc.4</version>
|
<version>5.0.0-rc.5</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>HeadDB</name>
|
<name>HeadDB</name>
|
||||||
|
@ -19,7 +19,6 @@ import tsp.headdb.core.economy.VaultProvider;
|
|||||||
import tsp.headdb.core.storage.Storage;
|
import tsp.headdb.core.storage.Storage;
|
||||||
import tsp.headdb.core.task.UpdateTask;
|
import tsp.headdb.core.task.UpdateTask;
|
||||||
|
|
||||||
import tsp.headdb.core.util.BuildProperties;
|
|
||||||
import tsp.headdb.core.util.HeadDBLogger;
|
import tsp.headdb.core.util.HeadDBLogger;
|
||||||
import tsp.smartplugin.SmartPlugin;
|
import tsp.smartplugin.SmartPlugin;
|
||||||
import tsp.smartplugin.inventory.PaneListener;
|
import tsp.smartplugin.inventory.PaneListener;
|
||||||
@ -35,7 +34,6 @@ public class HeadDB extends SmartPlugin {
|
|||||||
|
|
||||||
private static HeadDB instance;
|
private static HeadDB instance;
|
||||||
private HeadDBLogger logger;
|
private HeadDBLogger logger;
|
||||||
private BuildProperties buildProperties;
|
|
||||||
private TranslatableLocalization localization;
|
private TranslatableLocalization localization;
|
||||||
private Storage storage;
|
private Storage storage;
|
||||||
private BasicEconomyProvider economyProvider;
|
private BasicEconomyProvider economyProvider;
|
||||||
@ -47,7 +45,6 @@ public class HeadDB extends SmartPlugin {
|
|||||||
instance.saveDefaultConfig();
|
instance.saveDefaultConfig();
|
||||||
instance.logger = new HeadDBLogger(getConfig().getBoolean("debug"));
|
instance.logger = new HeadDBLogger(getConfig().getBoolean("debug"));
|
||||||
instance.logger.info("Loading HeadDB - " + instance.getDescription().getVersion());
|
instance.logger.info("Loading HeadDB - " + instance.getDescription().getVersion());
|
||||||
instance.buildProperties = new BuildProperties(this);
|
|
||||||
|
|
||||||
new UpdateTask(getConfig().getLong("refresh", 86400L)).schedule(this);
|
new UpdateTask(getConfig().getLong("refresh", 86400L)).schedule(this);
|
||||||
instance.logger.info("Loaded " + loadLocalization() + " languages!");
|
instance.logger.info("Loaded " + loadLocalization() + " languages!");
|
||||||
@ -177,10 +174,6 @@ public class HeadDB extends SmartPlugin {
|
|||||||
return localization;
|
return localization;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BuildProperties getBuildProperties() {
|
|
||||||
return buildProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HeadDBLogger getLog() {
|
public HeadDBLogger getLog() {
|
||||||
return logger;
|
return logger;
|
||||||
}
|
}
|
||||||
|
@ -1,83 +0,0 @@
|
|||||||
package tsp.headdb.core.api.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;
|
|
||||||
import tsp.headdb.implementation.head.Head;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called <strong>BEFORE</strong> a head is added to the inventory but <strong>AFTER</strong> the transaction is complete.
|
|
||||||
* This gives you the chance to cancel and refund the money.
|
|
||||||
* <strong>This event is fired asynchronously!</strong>
|
|
||||||
*
|
|
||||||
* @author TheSilentPro (Silent)
|
|
||||||
* @see Event#isAsynchronous()
|
|
||||||
*
|
|
||||||
* @deprecated Possible issues.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public class HeadPurchaseEvent extends Event implements Cancellable {
|
|
||||||
|
|
||||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
|
||||||
private Player player;
|
|
||||||
private Head head;
|
|
||||||
private BigDecimal cost;
|
|
||||||
private final boolean success;
|
|
||||||
private boolean cancelled;
|
|
||||||
|
|
||||||
public HeadPurchaseEvent(Player player, Head head, BigDecimal cost, boolean success) {
|
|
||||||
super(true);
|
|
||||||
this.player = player;
|
|
||||||
this.head = head;
|
|
||||||
this.cost = cost;
|
|
||||||
this.success = success;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSuccessful() {
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCancelled() {
|
|
||||||
return cancelled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCancelled(boolean cancel) {
|
|
||||||
this.cancelled = cancel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public HandlerList getHandlers() {
|
|
||||||
return HANDLER_LIST;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Player getPlayer() {
|
|
||||||
return player;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPlayer(Player player) {
|
|
||||||
this.player = player;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Head getHead() {
|
|
||||||
return head;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHead(Head head) {
|
|
||||||
this.head = head;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getCost() {
|
|
||||||
return cost;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCost(BigDecimal cost) {
|
|
||||||
this.cost = cost;
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,8 +2,6 @@ package tsp.headdb.core.command;
|
|||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import tsp.headdb.HeadDB;
|
import tsp.headdb.HeadDB;
|
||||||
import tsp.headdb.core.util.BuildProperties;
|
|
||||||
import tsp.headdb.core.util.Utils;
|
|
||||||
import tsp.smartplugin.player.PlayerUtils;
|
import tsp.smartplugin.player.PlayerUtils;
|
||||||
|
|
||||||
public class CommandInfo extends SubCommand {
|
public class CommandInfo extends SubCommand {
|
||||||
@ -15,10 +13,8 @@ public class CommandInfo extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void handle(CommandSender sender, String[] args) {
|
public void handle(CommandSender sender, String[] args) {
|
||||||
if (HeadDB.getInstance().getConfig().getBoolean("showAdvancedPluginInfo")) {
|
if (HeadDB.getInstance().getConfig().getBoolean("showAdvancedPluginInfo")) {
|
||||||
BuildProperties build = HeadDB.getInstance().getBuildProperties();
|
PlayerUtils.sendMessage(sender, "&7Running &6HeadDB - " + HeadDB.getInstance().getDescription().getVersion());
|
||||||
PlayerUtils.sendMessage(sender, "&7Running &6HeadDB - " + build.getVersion());
|
PlayerUtils.sendMessage(sender, "&7GitHub: &6https://github.com/TheSilentPro/HeadDB");
|
||||||
PlayerUtils.sendMessage(sender, "&7Created by &6" + Utils.toString(HeadDB.getInstance().getDescription().getAuthors()));
|
|
||||||
PlayerUtils.sendMessage(sender, "&7Compiled on &6" + build.getTimestamp() + " &7by &6" + build.getAuthor());
|
|
||||||
} else {
|
} else {
|
||||||
PlayerUtils.sendMessage(sender, "&7Running &6HeadDB &7by &6TheSilentPro (Silent)");
|
PlayerUtils.sendMessage(sender, "&7Running &6HeadDB &7by &6TheSilentPro (Silent)");
|
||||||
PlayerUtils.sendMessage(sender, "&7GitHub: &6https://github.com/TheSilentPro/HeadDB");
|
PlayerUtils.sendMessage(sender, "&7GitHub: &6https://github.com/TheSilentPro/HeadDB");
|
||||||
|
@ -135,24 +135,26 @@ public class CommandMain extends HeadDBCommand implements CommandExecutor, TabCo
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// local
|
// local
|
||||||
pane.setButton(getInstance().getConfig().getInt("gui.main.meta.local.slot"), new Button(Utils.getItemFromConfig("gui.main.meta.local.item", Material.COMPASS), e -> {
|
if (getInstance().getConfig().getBoolean("localHeads")) {
|
||||||
Set<LocalHead> localHeads = HeadAPI.getLocalHeads();
|
pane.setButton(getInstance().getConfig().getInt("gui.main.meta.local.slot"), new Button(Utils.getItemFromConfig("gui.main.meta.local.item", Material.COMPASS), e -> {
|
||||||
PagedPane localPane = Utils.createPaged(player, Utils.translateTitle(getLocalization().getMessage(player.getUniqueId(), "menu.main.local.name").orElse("Local Heads"), localHeads.size(), "Local"));
|
Set<LocalHead> localHeads = HeadAPI.getLocalHeads();
|
||||||
for (LocalHead head : localHeads) {
|
PagedPane localPane = Utils.createPaged(player, Utils.translateTitle(getLocalization().getMessage(player.getUniqueId(), "menu.main.local.name").orElse("Local Heads"), localHeads.size(), "Local"));
|
||||||
localPane.addButton(new Button(head.getItem(), le -> {
|
for (LocalHead head : localHeads) {
|
||||||
if (le.isLeftClick()) {
|
localPane.addButton(new Button(head.getItem(), le -> {
|
||||||
ItemStack localItem = head.getItem();
|
if (le.isLeftClick()) {
|
||||||
if (le.isShiftClick()) {
|
ItemStack localItem = head.getItem();
|
||||||
localItem.setAmount(64);
|
if (le.isShiftClick()) {
|
||||||
|
localItem.setAmount(64);
|
||||||
|
}
|
||||||
|
|
||||||
|
player.getInventory().addItem(localItem);
|
||||||
}
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
player.getInventory().addItem(localItem);
|
localPane.open(player);
|
||||||
}
|
}));
|
||||||
}));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
localPane.open(player);
|
|
||||||
}));
|
|
||||||
|
|
||||||
// Fill
|
// Fill
|
||||||
Utils.fill(pane, Utils.getItemFromConfig("gui.main.fill", Material.BLACK_STAINED_GLASS_PANE));
|
Utils.fill(pane, Utils.getItemFromConfig("gui.main.fill", Material.BLACK_STAINED_GLASS_PANE));
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
package tsp.headdb.core.util;
|
|
||||||
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class contains the properties of the build.
|
|
||||||
*
|
|
||||||
* @author TheSilentPro (Silent)
|
|
||||||
*/
|
|
||||||
public class BuildProperties {
|
|
||||||
|
|
||||||
private String version = "unknown";
|
|
||||||
private String timestamp = "unknown";
|
|
||||||
private String author = "unknown";
|
|
||||||
|
|
||||||
public BuildProperties(JavaPlugin plugin) {
|
|
||||||
InputStream in = plugin.getResource("plugin.yml");
|
|
||||||
if (in == null) {
|
|
||||||
plugin.getLogger().severe("Could not get plugin.yml to read build information.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
YamlConfiguration data = YamlConfiguration.loadConfiguration(new InputStreamReader(in));
|
|
||||||
this.version = data.getString("version", "unknown");
|
|
||||||
this.timestamp = data.getString("buildTimestamp", "unknown");
|
|
||||||
this.author = data.getString("buildAuthor", "unknown");
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getVersion() {
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTimestamp() {
|
|
||||||
return timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAuthor() {
|
|
||||||
return author;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,4 +1,3 @@
|
|||||||
#file: noinspection YAMLSchemaValidation
|
|
||||||
name: ${project.name}
|
name: ${project.name}
|
||||||
description: ${project.description}
|
description: ${project.description}
|
||||||
|
|
||||||
@ -9,18 +8,11 @@ api-version: 1.19
|
|||||||
author: TheSilentPro (Silent)
|
author: TheSilentPro (Silent)
|
||||||
spigot-id: 84967
|
spigot-id: 84967
|
||||||
|
|
||||||
buildTimestamp: ${build.timestamp}
|
|
||||||
buildAuthor: ${build.author}
|
|
||||||
|
|
||||||
# Although not up-to-date, spigot already includes gson. This is here just in case.
|
|
||||||
#libraries:
|
|
||||||
# - "com.google.code.gson:gson:2.10"
|
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
headdb:
|
headdb:
|
||||||
usage: /headdb help
|
usage: /headdb help
|
||||||
description: Open the database
|
description: Open the database
|
||||||
aliases: [hdb, headdatabase, headmenu]
|
aliases: ["hdb", "headdatabase", "headmenu"]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
headdb.admin:
|
headdb.admin:
|
||||||
@ -30,6 +22,10 @@ permissions:
|
|||||||
headdb.command.search: true
|
headdb.command.search: true
|
||||||
headdb.command.give: true
|
headdb.command.give: true
|
||||||
headdb.command.update: true
|
headdb.command.update: true
|
||||||
|
headdb.command.reload: true
|
||||||
|
headdb.command.language: true
|
||||||
|
headdb.command.settings: true
|
||||||
|
headdb.command.texture: true
|
||||||
headdb.favorites: true
|
headdb.favorites: true
|
||||||
headdb.local: true
|
headdb.local: true
|
||||||
headdb.category.*: true
|
headdb.category.*: true
|
||||||
@ -41,6 +37,14 @@ permissions:
|
|||||||
default: op
|
default: op
|
||||||
headdb.command.update:
|
headdb.command.update:
|
||||||
default: op
|
default: op
|
||||||
|
headdb.command.reload:
|
||||||
|
default: op
|
||||||
|
headdb.command.language:
|
||||||
|
default: op
|
||||||
|
headdb.command.settings:
|
||||||
|
default: op
|
||||||
|
headdb.command.texture:
|
||||||
|
default: op
|
||||||
headdb.favorites:
|
headdb.favorites:
|
||||||
default: op
|
default: op
|
||||||
headdb.local:
|
headdb.local:
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren