mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-12-22 00:58:04 +01:00
Renamed some classes to BSB...
This commit is contained in:
parent
4f0eadeea9
commit
a198c1a44a
@ -7,7 +7,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import us.tastybento.bskyblock.api.BSModule;
|
||||
import us.tastybento.bskyblock.api.BSBModule;
|
||||
import us.tastybento.bskyblock.commands.AdminCommand;
|
||||
import us.tastybento.bskyblock.commands.IslandCommand;
|
||||
import us.tastybento.bskyblock.config.PluginConfig;
|
||||
@ -28,7 +28,7 @@ import us.tastybento.bskyblock.util.nms.NMSAbstraction;
|
||||
* @author Tastybento
|
||||
* @author Poslovitch
|
||||
*/
|
||||
public class BSkyBlock extends JavaPlugin implements BSModule {
|
||||
public class BSkyBlock extends JavaPlugin implements BSBModule {
|
||||
|
||||
private static BSkyBlock plugin;
|
||||
|
||||
|
@ -2,7 +2,7 @@ package us.tastybento.bskyblock.api;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public interface BSModule {
|
||||
public interface BSBModule {
|
||||
|
||||
String getIdentifier();
|
||||
boolean isAddon();
|
@ -1,7 +1,7 @@
|
||||
package us.tastybento.bskyblock.api.addons;
|
||||
|
||||
/**
|
||||
* Represents the current run-time state of a {@link BSAddon}.
|
||||
* Represents the current run-time state of a {@link BSBAddon}.
|
||||
*
|
||||
* @author Poslovitch
|
||||
* @since 1.0
|
||||
|
@ -3,11 +3,11 @@ package us.tastybento.bskyblock.api.addons;
|
||||
import java.io.File;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.BSModule;
|
||||
import us.tastybento.bskyblock.api.BSBModule;
|
||||
import us.tastybento.bskyblock.managers.CommandsManager;
|
||||
import us.tastybento.bskyblock.managers.LocalesManager;
|
||||
|
||||
public abstract class BSAddon implements BSModule {
|
||||
public abstract class BSBAddon implements BSBModule {
|
||||
|
||||
private File folder;
|
||||
private AddonDescription description;
|
@ -9,7 +9,7 @@ import java.util.Optional;
|
||||
* @author ben
|
||||
*
|
||||
*/
|
||||
public interface BSCommand {
|
||||
public interface BSBCommand {
|
||||
|
||||
/**
|
||||
* Anything that needs to be set up for this command.
|
@ -27,7 +27,7 @@ import us.tastybento.bskyblock.util.Util;
|
||||
* @author ben, poslovich
|
||||
*
|
||||
*/
|
||||
public abstract class CompositeCommand extends Command implements PluginIdentifiableCommand, BSCommand {
|
||||
public abstract class CompositeCommand extends Command implements PluginIdentifiableCommand, BSBCommand {
|
||||
|
||||
private static final boolean DEBUG = false;
|
||||
/**
|
||||
|
@ -9,7 +9,7 @@ import org.bukkit.event.HandlerList;
|
||||
* @author tastybento
|
||||
* @since 1.0
|
||||
*/
|
||||
public class BSkyBlockReadyEvent extends Event {
|
||||
public class BSBReadyEvent extends Event {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
@ -11,13 +11,13 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
||||
/**
|
||||
* @author Poslovitch, Tastybento
|
||||
*/
|
||||
public class BSLocale {
|
||||
public class BSBLocale {
|
||||
|
||||
private Locale locale;
|
||||
private YamlConfiguration config;
|
||||
private Map<String, String> cache;
|
||||
|
||||
public BSLocale(String languageTag, File file) {
|
||||
public BSBLocale(String languageTag, File file) {
|
||||
this.locale = Locale.forLanguageTag(languageTag);
|
||||
this.config = YamlConfiguration.loadConfiguration(file);
|
||||
this.cache = new HashMap<>();
|
@ -1,8 +1,6 @@
|
||||
package us.tastybento.bskyblock.commands.island.teams;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
@ -21,9 +19,4 @@ public class IslandTeamPromoteCommand extends AbstractIslandTeamCommand {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<List<String>> tabComplete(final User user, final String alias, final LinkedList<String> args) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -3,13 +3,13 @@ package us.tastybento.bskyblock.managers;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import us.tastybento.bskyblock.api.addons.BSAddon;
|
||||
import us.tastybento.bskyblock.api.addons.BSBAddon;
|
||||
|
||||
public final class AddonsManager {
|
||||
|
||||
private final List<BSAddon> addons = new ArrayList<>();
|
||||
private final List<BSBAddon> addons = new ArrayList<>();
|
||||
|
||||
public List<BSAddon> getAddons() {
|
||||
public List<BSBAddon> getAddons() {
|
||||
return addons;
|
||||
}
|
||||
}
|
||||
|
@ -8,13 +8,13 @@ import java.util.Map;
|
||||
import org.bukkit.command.Command;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.BSModule;
|
||||
import us.tastybento.bskyblock.api.BSBModule;
|
||||
|
||||
public final class CommandsManager {
|
||||
|
||||
private Map<BSModule, List<Command>> commands = new LinkedHashMap<>();
|
||||
private Map<BSBModule, List<Command>> commands = new LinkedHashMap<>();
|
||||
|
||||
public void registerCommand(BSModule module, Command command) {
|
||||
public void registerCommand(BSBModule module, Command command) {
|
||||
List<Command> cmds = new ArrayList<>();
|
||||
if (commands.containsKey(module)) {
|
||||
cmds = commands.get(module);
|
||||
@ -29,7 +29,7 @@ public final class CommandsManager {
|
||||
|
||||
}
|
||||
|
||||
public List<Command> getCommands(BSModule module) {
|
||||
public List<Command> getCommands(BSBModule module) {
|
||||
return commands.get(module);
|
||||
}
|
||||
|
||||
|
@ -9,8 +9,8 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.BSModule;
|
||||
import us.tastybento.bskyblock.api.localization.BSLocale;
|
||||
import us.tastybento.bskyblock.api.BSBModule;
|
||||
import us.tastybento.bskyblock.api.localization.BSBLocale;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
|
||||
/**
|
||||
@ -19,7 +19,7 @@ import us.tastybento.bskyblock.config.Settings;
|
||||
public final class LocalesManager {
|
||||
|
||||
private BSkyBlock plugin;
|
||||
private Map<BSModule, List<BSLocale>> locales;
|
||||
private Map<BSBModule, List<BSBLocale>> locales;
|
||||
|
||||
public LocalesManager(BSkyBlock plugin) {
|
||||
this.plugin = plugin;
|
||||
@ -39,10 +39,10 @@ public final class LocalesManager {
|
||||
|
||||
if (reference.contains(":")) { // if reference addresses directly the module like "bskyblock:general.errors.use-in-game"
|
||||
String[] path = reference.split(":", 1);
|
||||
for (BSModule module : locales.keySet()) {
|
||||
for (BSBModule module : locales.keySet()) {
|
||||
if (module.getIdentifier().toLowerCase().equals(path[0].toLowerCase())) {
|
||||
// CommandSender doesnt have any data stored, so we have to get the default language
|
||||
BSLocale locale = getLocale(module, Settings.defaultLanguage);
|
||||
BSBLocale locale = getLocale(module, Settings.defaultLanguage);
|
||||
String translation = path[1];
|
||||
|
||||
if (locale != null) translation = locale.get(path[1]);
|
||||
@ -58,9 +58,9 @@ public final class LocalesManager {
|
||||
}
|
||||
} else {
|
||||
// Run through each module's locales to try find the reference
|
||||
for (BSModule module : locales.keySet()) {
|
||||
for (BSBModule module : locales.keySet()) {
|
||||
// CommandSender doesnt have any data stored, so we have to get the default language
|
||||
BSLocale locale = getLocale(module, Settings.defaultLanguage);
|
||||
BSBLocale locale = getLocale(module, Settings.defaultLanguage);
|
||||
String translation = reference;
|
||||
|
||||
if (locale != null) translation = locale.get(reference);
|
||||
@ -87,10 +87,10 @@ public final class LocalesManager {
|
||||
public String get(UUID uuid, String reference) {
|
||||
if (reference.contains(":")) { // if reference addresses directly the module like "bskyblock:general.errors.use-in-game"
|
||||
String[] path = reference.split(":", 1);
|
||||
for (BSModule module : locales.keySet()) {
|
||||
for (BSBModule module : locales.keySet()) {
|
||||
if (module.getIdentifier().toLowerCase().equals(path[0].toLowerCase())) {
|
||||
// Firstly try to find the translation in player's locale
|
||||
BSLocale locale = getLocale(module, plugin.getPlayers().getLocale(uuid));
|
||||
BSBLocale locale = getLocale(module, plugin.getPlayers().getLocale(uuid));
|
||||
String translation = path[1];
|
||||
|
||||
if (locale != null) translation = locale.get(path[1]);
|
||||
@ -113,9 +113,9 @@ public final class LocalesManager {
|
||||
}
|
||||
} else {
|
||||
// Run through each module's locales to try find the reference
|
||||
for (BSModule module : locales.keySet()) {
|
||||
for (BSBModule module : locales.keySet()) {
|
||||
// Firstly try to find the translation in player's locale
|
||||
BSLocale locale = getLocale(module, plugin.getPlayers().getLocale(uuid));
|
||||
BSBLocale locale = getLocale(module, plugin.getPlayers().getLocale(uuid));
|
||||
String translation = reference;
|
||||
|
||||
if (locale != null) translation = locale.get(reference);
|
||||
@ -140,33 +140,33 @@ public final class LocalesManager {
|
||||
return reference; // Return reference to tell the user that no translation has been found
|
||||
}
|
||||
|
||||
public Map<BSModule, List<BSLocale>> getLocales() {
|
||||
public Map<BSBModule, List<BSBLocale>> getLocales() {
|
||||
return locales;
|
||||
}
|
||||
|
||||
public List<BSLocale> getLocales(BSModule module) {
|
||||
public List<BSBLocale> getLocales(BSBModule module) {
|
||||
return locales.get(module);
|
||||
}
|
||||
|
||||
public BSLocale getLocale(BSModule module, String languageTag) {
|
||||
for (BSLocale locale : locales.get(module)) {
|
||||
public BSBLocale getLocale(BSBModule module, String languageTag) {
|
||||
for (BSBLocale locale : locales.get(module)) {
|
||||
if (locale.toLanguageTag().equals(languageTag)) return locale;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void registerLocales(BSModule module) {
|
||||
public void registerLocales(BSBModule module) {
|
||||
// Check if the folder exists and contains the locales
|
||||
|
||||
// for each languageTag found, do registerLocale(module, languageTag)
|
||||
//TODO
|
||||
}
|
||||
|
||||
public void registerLocale(BSModule module, String languageTag) {
|
||||
public void registerLocale(BSBModule module, String languageTag) {
|
||||
//TODO
|
||||
}
|
||||
|
||||
public void registerExternalLocale(BSModule originModule, BSModule targetModule, String languageTag) {
|
||||
public void registerExternalLocale(BSBModule originModule, BSBModule targetModule, String languageTag) {
|
||||
//TODO
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user