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>
|
||||
<artifactId>HeadDB</artifactId>
|
||||
<version>5.0.0-rc.4</version>
|
||||
<version>5.0.0-rc.5</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>HeadDB</name>
|
||||
|
@ -19,7 +19,6 @@ import tsp.headdb.core.economy.VaultProvider;
|
||||
import tsp.headdb.core.storage.Storage;
|
||||
import tsp.headdb.core.task.UpdateTask;
|
||||
|
||||
import tsp.headdb.core.util.BuildProperties;
|
||||
import tsp.headdb.core.util.HeadDBLogger;
|
||||
import tsp.smartplugin.SmartPlugin;
|
||||
import tsp.smartplugin.inventory.PaneListener;
|
||||
@ -35,7 +34,6 @@ public class HeadDB extends SmartPlugin {
|
||||
|
||||
private static HeadDB instance;
|
||||
private HeadDBLogger logger;
|
||||
private BuildProperties buildProperties;
|
||||
private TranslatableLocalization localization;
|
||||
private Storage storage;
|
||||
private BasicEconomyProvider economyProvider;
|
||||
@ -47,7 +45,6 @@ public class HeadDB extends SmartPlugin {
|
||||
instance.saveDefaultConfig();
|
||||
instance.logger = new HeadDBLogger(getConfig().getBoolean("debug"));
|
||||
instance.logger.info("Loading HeadDB - " + instance.getDescription().getVersion());
|
||||
instance.buildProperties = new BuildProperties(this);
|
||||
|
||||
new UpdateTask(getConfig().getLong("refresh", 86400L)).schedule(this);
|
||||
instance.logger.info("Loaded " + loadLocalization() + " languages!");
|
||||
@ -177,10 +174,6 @@ public class HeadDB extends SmartPlugin {
|
||||
return localization;
|
||||
}
|
||||
|
||||
public BuildProperties getBuildProperties() {
|
||||
return buildProperties;
|
||||
}
|
||||
|
||||
public HeadDBLogger getLog() {
|
||||
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 tsp.headdb.HeadDB;
|
||||
import tsp.headdb.core.util.BuildProperties;
|
||||
import tsp.headdb.core.util.Utils;
|
||||
import tsp.smartplugin.player.PlayerUtils;
|
||||
|
||||
public class CommandInfo extends SubCommand {
|
||||
@ -15,10 +13,8 @@ public class CommandInfo extends SubCommand {
|
||||
@Override
|
||||
public void handle(CommandSender sender, String[] args) {
|
||||
if (HeadDB.getInstance().getConfig().getBoolean("showAdvancedPluginInfo")) {
|
||||
BuildProperties build = HeadDB.getInstance().getBuildProperties();
|
||||
PlayerUtils.sendMessage(sender, "&7Running &6HeadDB - " + build.getVersion());
|
||||
PlayerUtils.sendMessage(sender, "&7Created by &6" + Utils.toString(HeadDB.getInstance().getDescription().getAuthors()));
|
||||
PlayerUtils.sendMessage(sender, "&7Compiled on &6" + build.getTimestamp() + " &7by &6" + build.getAuthor());
|
||||
PlayerUtils.sendMessage(sender, "&7Running &6HeadDB - " + HeadDB.getInstance().getDescription().getVersion());
|
||||
PlayerUtils.sendMessage(sender, "&7GitHub: &6https://github.com/TheSilentPro/HeadDB");
|
||||
} else {
|
||||
PlayerUtils.sendMessage(sender, "&7Running &6HeadDB &7by &6TheSilentPro (Silent)");
|
||||
PlayerUtils.sendMessage(sender, "&7GitHub: &6https://github.com/TheSilentPro/HeadDB");
|
||||
|
@ -135,6 +135,7 @@ public class CommandMain extends HeadDBCommand implements CommandExecutor, TabCo
|
||||
}));
|
||||
|
||||
// local
|
||||
if (getInstance().getConfig().getBoolean("localHeads")) {
|
||||
pane.setButton(getInstance().getConfig().getInt("gui.main.meta.local.slot"), new Button(Utils.getItemFromConfig("gui.main.meta.local.item", Material.COMPASS), e -> {
|
||||
Set<LocalHead> localHeads = HeadAPI.getLocalHeads();
|
||||
PagedPane localPane = Utils.createPaged(player, Utils.translateTitle(getLocalization().getMessage(player.getUniqueId(), "menu.main.local.name").orElse("Local Heads"), localHeads.size(), "Local"));
|
||||
@ -153,6 +154,7 @@ public class CommandMain extends HeadDBCommand implements CommandExecutor, TabCo
|
||||
|
||||
localPane.open(player);
|
||||
}));
|
||||
}
|
||||
|
||||
// Fill
|
||||
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}
|
||||
description: ${project.description}
|
||||
|
||||
@ -9,18 +8,11 @@ api-version: 1.19
|
||||
author: TheSilentPro (Silent)
|
||||
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:
|
||||
headdb:
|
||||
usage: /headdb help
|
||||
description: Open the database
|
||||
aliases: [hdb, headdatabase, headmenu]
|
||||
aliases: ["hdb", "headdatabase", "headmenu"]
|
||||
|
||||
permissions:
|
||||
headdb.admin:
|
||||
@ -30,6 +22,10 @@ permissions:
|
||||
headdb.command.search: true
|
||||
headdb.command.give: 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.local: true
|
||||
headdb.category.*: true
|
||||
@ -41,6 +37,14 @@ permissions:
|
||||
default: op
|
||||
headdb.command.update:
|
||||
default: op
|
||||
headdb.command.reload:
|
||||
default: op
|
||||
headdb.command.language:
|
||||
default: op
|
||||
headdb.command.settings:
|
||||
default: op
|
||||
headdb.command.texture:
|
||||
default: op
|
||||
headdb.favorites:
|
||||
default: op
|
||||
headdb.local:
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren