mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Refactoring: Relocated Plugin class
This commit is contained in:
parent
ca36271a79
commit
3dc043c857
@ -18,7 +18,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.Objects.handlers.BlockTicker;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
|
@ -2,7 +2,7 @@ package io.github.thebusybiscuit.slimefun4.api;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
/**
|
||||
* This enum holds all versions of Minecraft that we currently support.
|
||||
|
@ -10,7 +10,7 @@ import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
|
||||
|
@ -10,9 +10,9 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.events.GEOResourceGenerationEvent;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.geo.GEOMiner;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.geo.GEOScanner;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
|
||||
/**
|
||||
* A {@link GEOResource} is a virtual resource that can be thought of as world-gen.
|
||||
@ -91,7 +91,7 @@ public interface GEOResource extends Keyed {
|
||||
* @return The localized name for this {@link GEOResource}
|
||||
*/
|
||||
default String getName(Player p) {
|
||||
String name = SlimefunPlugin.getLocal().getResourceString(p, "resources." + getKey().getNamespace() + "." + getKey().getKey());
|
||||
String name = SlimefunPlugin.getLocalization().getResourceString(p, "resources." + getKey().getNamespace() + "." + getKey().getKey());
|
||||
return name == null ? getName() : name;
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
@ -20,12 +21,13 @@ import io.github.thebusybiscuit.cscorelib2.config.Config;
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.api.events.GEOResourceGenerationEvent;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.geo.GEOMiner;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.geo.GEOScanner;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.HeadTexture;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
|
||||
/**
|
||||
@ -42,7 +44,6 @@ import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
public class ResourceManager {
|
||||
|
||||
private final int[] backgroundSlots = { 0, 1, 2, 3, 5, 6, 7, 8, 9, 17, 18, 26, 27, 35, 36, 44, 45, 46, 48, 49, 50, 52, 53 };
|
||||
private final ItemStack chunkTexture = SlimefunUtils.getCustomHead("8449b9318e33158e64a46ab0de121c3d40000e3332c1574932b3c849d8fa0dc2");
|
||||
private final Config config;
|
||||
|
||||
public ResourceManager(SlimefunPlugin plugin) {
|
||||
@ -77,7 +78,26 @@ public class ResourceManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the amount of a certain {@link GEOResource} found in a given {@link Chunk}.
|
||||
* The result is an {@link OptionalInt} which will be empty if this {@link GEOResource}
|
||||
* has not been generated at that {@link Location} yet.
|
||||
*
|
||||
* @param resource
|
||||
* The {@link GEOResource} to query
|
||||
* @param world
|
||||
* The {@link World} of this {@link Location}
|
||||
* @param x
|
||||
* The {@link Chunk} x cordinate
|
||||
* @param z
|
||||
* The {@link Chunk} z cordinate
|
||||
*
|
||||
* @return An {@link OptionalInt}, either empty or containing the amount of the given {@link GEOResource}
|
||||
*/
|
||||
public OptionalInt getSupplies(GEOResource resource, World world, int x, int z) {
|
||||
Validate.notNull(resource, "Cannot get supplies for null");
|
||||
Validate.notNull(world, "World must not be null");
|
||||
|
||||
String key = resource.getKey().toString().replace(':', '-');
|
||||
String value = BlockStorage.getChunkInfo(world, x, z, key);
|
||||
|
||||
@ -90,11 +110,17 @@ public class ResourceManager {
|
||||
}
|
||||
|
||||
public void setSupplies(GEOResource resource, World world, int x, int z, int value) {
|
||||
Validate.notNull(resource, "Cannot set supplies for null");
|
||||
Validate.notNull(world, "World cannot be null");
|
||||
|
||||
String key = resource.getKey().toString().replace(':', '-');
|
||||
BlockStorage.setChunkInfo(world, x, z, key, String.valueOf(value));
|
||||
}
|
||||
|
||||
private int generate(GEOResource resource, World world, int x, int z) {
|
||||
Validate.notNull(resource, "Cannot generate resources for null");
|
||||
Validate.notNull(world, "World cannot be null");
|
||||
|
||||
Block block = world.getBlockAt(x << 4, 72, z << 4);
|
||||
int value = resource.getDefaultSupply(world.getEnvironment(), block.getBiome());
|
||||
|
||||
@ -133,20 +159,20 @@ public class ResourceManager {
|
||||
*/
|
||||
public void scan(Player p, Block block, int page) {
|
||||
if (SlimefunPlugin.getGPSNetwork().getNetworkComplexity(p.getUniqueId()) < 600) {
|
||||
SlimefunPlugin.getLocal().sendMessages(p, "gps.insufficient-complexity", true, msg -> msg.replace("%complexity%", "600"));
|
||||
SlimefunPlugin.getLocalization().sendMessages(p, "gps.insufficient-complexity", true, msg -> msg.replace("%complexity%", "600"));
|
||||
return;
|
||||
}
|
||||
|
||||
int x = block.getX() >> 4;
|
||||
int z = block.getZ() >> 4;
|
||||
|
||||
ChestMenu menu = new ChestMenu("&4" + SlimefunPlugin.getLocal().getResourceString(p, "tooltips.results"));
|
||||
ChestMenu menu = new ChestMenu("&4" + SlimefunPlugin.getLocalization().getResourceString(p, "tooltips.results"));
|
||||
|
||||
for (int slot : backgroundSlots) {
|
||||
menu.addItem(slot, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
|
||||
}
|
||||
|
||||
menu.addItem(4, new CustomItem(chunkTexture, "&e" + SlimefunPlugin.getLocal().getResourceString(p, "tooltips.chunk"), "", "&8\u21E8 &7" + SlimefunPlugin.getLocal().getResourceString(p, "tooltips.world") + ": " + block.getWorld().getName(), "&8\u21E8 &7X: " + x + " Z: " + z), ChestMenuUtils.getEmptyClickHandler());
|
||||
menu.addItem(4, new CustomItem(SlimefunUtils.getCustomHead(HeadTexture.MINECRAFT_CHUNK.getTexture()), ChatColor.YELLOW + SlimefunPlugin.getLocalization().getResourceString(p, "tooltips.chunk"), "", "&8\u21E8 &7" + SlimefunPlugin.getLocalization().getResourceString(p, "tooltips.world") + ": " + block.getWorld().getName(), "&8\u21E8 &7X: " + x + " Z: " + z), ChestMenuUtils.getEmptyClickHandler());
|
||||
List<GEOResource> resources = new ArrayList<>(SlimefunPlugin.getRegistry().getGEOResources().values());
|
||||
Collections.sort(resources, (a, b) -> a.getName(p).toLowerCase(Locale.ROOT).compareTo(b.getName(p).toLowerCase(Locale.ROOT)));
|
||||
|
||||
@ -157,9 +183,9 @@ public class ResourceManager {
|
||||
GEOResource resource = resources.get(i);
|
||||
OptionalInt optional = getSupplies(resource, block.getWorld(), x, z);
|
||||
int supplies = optional.isPresent() ? optional.getAsInt() : generate(resource, block.getWorld(), x, z);
|
||||
String suffix = SlimefunPlugin.getLocal().getResourceString(p, supplies == 1 ? "tooltips.unit" : "tooltips.units");
|
||||
String suffix = SlimefunPlugin.getLocalization().getResourceString(p, supplies == 1 ? "tooltips.unit" : "tooltips.units");
|
||||
|
||||
ItemStack item = new CustomItem(resource.getItem(), "&r" + resource.getName(p), "&8\u21E8 &e" + supplies + ' ' + suffix);
|
||||
ItemStack item = new CustomItem(resource.getItem(), "&f" + resource.getName(p), "&8\u21E8 &e" + supplies + ' ' + suffix);
|
||||
|
||||
if (supplies > 1) {
|
||||
item.setAmount(supplies > item.getMaxStackSize() ? item.getMaxStackSize() : supplies);
|
||||
|
@ -26,12 +26,12 @@ import io.github.thebusybiscuit.slimefun4.api.geo.GEOResource;
|
||||
import io.github.thebusybiscuit.slimefun4.api.geo.ResourceManager;
|
||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.gps.GPSTransmitter;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.gps.Teleporter;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.HeadTexture;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
@ -123,14 +123,14 @@ public class GPSNetwork {
|
||||
}
|
||||
|
||||
public void openTransmitterControlPanel(Player p) {
|
||||
ChestMenu menu = new ChestMenu(ChatColor.BLUE + SlimefunPlugin.getLocal().getMessage(p, "machines.GPS_CONTROL_PANEL.title"));
|
||||
ChestMenu menu = new ChestMenu(ChatColor.BLUE + SlimefunPlugin.getLocalization().getMessage(p, "machines.GPS_CONTROL_PANEL.title"));
|
||||
|
||||
for (int slot : border) {
|
||||
menu.addItem(slot, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
|
||||
}
|
||||
|
||||
menu.addItem(2, new CustomItem(SlimefunItems.GPS_TRANSMITTER, im -> {
|
||||
im.setDisplayName(ChatColor.GRAY + SlimefunPlugin.getLocal().getMessage(p, "machines.GPS_CONTROL_PANEL.transmitters"));
|
||||
im.setDisplayName(ChatColor.GRAY + SlimefunPlugin.getLocalization().getMessage(p, "machines.GPS_CONTROL_PANEL.transmitters"));
|
||||
im.setLore(null);
|
||||
}));
|
||||
|
||||
@ -140,7 +140,7 @@ public class GPSNetwork {
|
||||
menu.addItem(4, new CustomItem(SlimefunItems.GPS_CONTROL_PANEL, "&7Network Info", "", "&8\u21E8 &7Status: " + (complexity > 0 ? "&2&lONLINE" : "&4&lOFFLINE"), "&8\u21E8 &7Complexity: &f" + complexity));
|
||||
menu.addMenuClickHandler(4, ChestMenuUtils.getEmptyClickHandler());
|
||||
|
||||
menu.addItem(6, new CustomItem(HeadTexture.GLOBE_OVERWORLD.getAsItemStack(), "&7" + SlimefunPlugin.getLocal().getMessage(p, "machines.GPS_CONTROL_PANEL.waypoints"), "", ChatColor.GRAY + "\u21E8 " + SlimefunPlugin.getLocal().getMessage(p, "guide.tooltips.open-category")));
|
||||
menu.addItem(6, new CustomItem(HeadTexture.GLOBE_OVERWORLD.getAsItemStack(), "&7" + SlimefunPlugin.getLocalization().getMessage(p, "machines.GPS_CONTROL_PANEL.waypoints"), "", ChatColor.GRAY + "\u21E8 " + SlimefunPlugin.getLocalization().getMessage(p, "guide.tooltips.open-category")));
|
||||
menu.addMenuClickHandler(6, (pl, slot, item, action) -> {
|
||||
openWaypointControlPanel(pl);
|
||||
return false;
|
||||
@ -196,13 +196,13 @@ public class GPSNetwork {
|
||||
|
||||
public void openWaypointControlPanel(Player p) {
|
||||
PlayerProfile.get(p, profile -> {
|
||||
ChestMenu menu = new ChestMenu(ChatColor.BLUE + SlimefunPlugin.getLocal().getMessage(p, "machines.GPS_CONTROL_PANEL.title"));
|
||||
ChestMenu menu = new ChestMenu(ChatColor.BLUE + SlimefunPlugin.getLocalization().getMessage(p, "machines.GPS_CONTROL_PANEL.title"));
|
||||
|
||||
for (int slot : border) {
|
||||
menu.addItem(slot, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
|
||||
}
|
||||
|
||||
menu.addItem(2, new CustomItem(SlimefunItems.GPS_TRANSMITTER, "&7" + SlimefunPlugin.getLocal().getMessage(p, "machines.GPS_CONTROL_PANEL.transmitters"), "", ChatColor.GRAY + "\u21E8 " + SlimefunPlugin.getLocal().getMessage(p, "guide.tooltips.open-category")));
|
||||
menu.addItem(2, new CustomItem(SlimefunItems.GPS_TRANSMITTER, "&7" + SlimefunPlugin.getLocalization().getMessage(p, "machines.GPS_CONTROL_PANEL.transmitters"), "", ChatColor.GRAY + "\u21E8 " + SlimefunPlugin.getLocalization().getMessage(p, "guide.tooltips.open-category")));
|
||||
menu.addMenuClickHandler(2, (pl, slot, item, action) -> {
|
||||
openTransmitterControlPanel(pl);
|
||||
return false;
|
||||
@ -212,7 +212,7 @@ public class GPSNetwork {
|
||||
menu.addItem(4, new CustomItem(SlimefunItems.GPS_CONTROL_PANEL, "&7Network Info", "", "&8\u21E8 &7Status: " + (complexity > 0 ? "&2&lONLINE" : "&4&lOFFLINE"), "&8\u21E8 &7Complexity: &f" + complexity));
|
||||
menu.addMenuClickHandler(4, ChestMenuUtils.getEmptyClickHandler());
|
||||
|
||||
menu.addItem(6, new CustomItem(HeadTexture.GLOBE_OVERWORLD.getAsItemStack(), "&7" + SlimefunPlugin.getLocal().getMessage(p, "machines.GPS_CONTROL_PANEL.waypoints")));
|
||||
menu.addItem(6, new CustomItem(HeadTexture.GLOBE_OVERWORLD.getAsItemStack(), "&7" + SlimefunPlugin.getLocalization().getMessage(p, "machines.GPS_CONTROL_PANEL.waypoints")));
|
||||
menu.addMenuClickHandler(6, ChestMenuUtils.getEmptyClickHandler());
|
||||
|
||||
int index = 0;
|
||||
@ -249,11 +249,11 @@ public class GPSNetwork {
|
||||
public void createWaypoint(Player p, Location l) {
|
||||
PlayerProfile.get(p, profile -> {
|
||||
if ((profile.getWaypoints().size() + 2) > inventory.length) {
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "gps.waypoint.max", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "gps.waypoint.max", true);
|
||||
return;
|
||||
}
|
||||
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "gps.waypoint.new", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "gps.waypoint.new", true);
|
||||
p.playSound(p.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 0.5F, 1F);
|
||||
|
||||
ChatInput.waitForPlayer(SlimefunPlugin.instance, p, message -> addWaypoint(p, message, l));
|
||||
@ -273,7 +273,7 @@ public class GPSNetwork {
|
||||
public void addWaypoint(Player p, String name, Location l) {
|
||||
PlayerProfile.get(p, profile -> {
|
||||
if ((profile.getWaypoints().size() + 2) > inventory.length) {
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "gps.waypoint.max", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "gps.waypoint.max", true);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -286,7 +286,7 @@ public class GPSNetwork {
|
||||
profile.addWaypoint(new Waypoint(profile, id, event.getLocation(), event.getName()));
|
||||
|
||||
p.playSound(p.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 1F, 1F);
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "gps.waypoint.added", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "gps.waypoint.added", true);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -18,10 +18,10 @@ import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.cscorelib2.math.DoubleHandler;
|
||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.HeadTexture;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
public final class TeleportationManager {
|
||||
@ -46,7 +46,7 @@ public final class TeleportationManager {
|
||||
menu.addItem(slot, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
|
||||
}
|
||||
|
||||
menu.addItem(4, new CustomItem(HeadTexture.GLOBE_OVERWORLD.getAsItemStack(), ChatColor.YELLOW + SlimefunPlugin.getLocal().getMessage(p, "machines.TELEPORTER.gui.title")));
|
||||
menu.addItem(4, new CustomItem(HeadTexture.GLOBE_OVERWORLD.getAsItemStack(), ChatColor.YELLOW + SlimefunPlugin.getLocalization().getMessage(p, "machines.TELEPORTER.gui.title")));
|
||||
menu.addMenuClickHandler(4, ChestMenuUtils.getEmptyClickHandler());
|
||||
|
||||
Location source = new Location(b.getWorld(), b.getX() + 0.5D, b.getY() + 2D, b.getZ() + 0.5D);
|
||||
@ -61,7 +61,7 @@ public final class TeleportationManager {
|
||||
|
||||
Location l = waypoint.getLocation();
|
||||
menu.addItem(slot,
|
||||
new CustomItem(waypoint.getIcon(), waypoint.getName().replace("player:death ", ""), "", "&8\u21E8 &7" + SlimefunPlugin.getLocal().getResourceString(p, "tooltips.world") + ": &f" + l.getWorld().getName(), "&8\u21E8 &7X: &f" + l.getX(), "&8\u21E8 &7Y: &f" + l.getY(), "&8\u21E8 &7Z: &f" + l.getZ(), "&8\u21E8 &7" + SlimefunPlugin.getLocal().getMessage(p, "machines.TELEPORTER.gui.time") + ": &f" + DoubleHandler.fixDouble(0.5 * getTeleportationTime(complexity, source, l)) + "s", "", "&8\u21E8 &c" + SlimefunPlugin.getLocal().getMessage(p, "machines.TELEPORTER.gui.tooltip")));
|
||||
new CustomItem(waypoint.getIcon(), waypoint.getName().replace("player:death ", ""), "", "&8\u21E8 &7" + SlimefunPlugin.getLocalization().getResourceString(p, "tooltips.world") + ": &f" + l.getWorld().getName(), "&8\u21E8 &7X: &f" + l.getX(), "&8\u21E8 &7Y: &f" + l.getY(), "&8\u21E8 &7Z: &f" + l.getZ(), "&8\u21E8 &7" + SlimefunPlugin.getLocalization().getMessage(p, "machines.TELEPORTER.gui.time") + ": &f" + DoubleHandler.fixDouble(0.5 * getTeleportationTime(complexity, source, l)) + "s", "", "&8\u21E8 &c" + SlimefunPlugin.getLocalization().getMessage(p, "machines.TELEPORTER.gui.tooltip")));
|
||||
menu.addMenuClickHandler(slot, (pl, s, item, action) -> {
|
||||
pl.closeInventory();
|
||||
teleport(pl.getUniqueId(), complexity, source, l, false);
|
||||
@ -107,7 +107,7 @@ public final class TeleportationManager {
|
||||
teleporterUsers.remove(uuid);
|
||||
|
||||
if (p != null) {
|
||||
p.sendTitle(ChatColors.color(SlimefunPlugin.getLocal().getMessage(p, "machines.TELEPORTER.cancelled")), ChatColors.color("&c&k40&f&c%"), 20, 60, 20);
|
||||
p.sendTitle(ChatColors.color(SlimefunPlugin.getLocalization().getMessage(p, "machines.TELEPORTER.cancelled")), ChatColors.color("&c&k40&f&c%"), 20, 60, 20);
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,12 +116,12 @@ public final class TeleportationManager {
|
||||
|
||||
if (isValid(p, source)) {
|
||||
if (progress > 99) {
|
||||
p.sendTitle(ChatColors.color(SlimefunPlugin.getLocal().getMessage(p, "machines.TELEPORTER.teleported")), ChatColors.color("&b100%"), 20, 60, 20);
|
||||
p.sendTitle(ChatColors.color(SlimefunPlugin.getLocalization().getMessage(p, "machines.TELEPORTER.teleported")), ChatColors.color("&b100%"), 20, 60, 20);
|
||||
p.teleport(destination);
|
||||
|
||||
if (resistance) {
|
||||
p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 600, 20));
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "machines.TELEPORTER.invulnerability");
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "machines.TELEPORTER.invulnerability");
|
||||
}
|
||||
|
||||
destination.getWorld().spawnParticle(Particle.PORTAL, new Location(destination.getWorld(), destination.getX(), destination.getY() + 1, destination.getZ()), progress * 2, 0.2F, 0.8F, 0.2F);
|
||||
@ -129,7 +129,7 @@ public final class TeleportationManager {
|
||||
teleporterUsers.remove(uuid);
|
||||
}
|
||||
else {
|
||||
p.sendTitle(ChatColors.color(SlimefunPlugin.getLocal().getMessage(p, "machines.TELEPORTER.teleporting")), ChatColors.color("&b" + progress + "%"), 0, 60, 0);
|
||||
p.sendTitle(ChatColors.color(SlimefunPlugin.getLocalization().getMessage(p, "machines.TELEPORTER.teleporting")), ChatColors.color("&b" + progress + "%"), 0, 60, 0);
|
||||
|
||||
source.getWorld().spawnParticle(Particle.PORTAL, source, progress * 2, 0.2F, 0.8F, 0.2F);
|
||||
source.getWorld().playSound(source, Sound.BLOCK_BEACON_AMBIENT, 1F, 0.6F);
|
||||
|
@ -9,8 +9,8 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.events.WaypointCreateEvent;
|
||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.gps.Teleporter;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
|
||||
/**
|
||||
* A {@link Waypoint} represents a named {@link Location} that was created by a {@link Player}.
|
||||
|
@ -5,7 +5,7 @@ import java.util.logging.Level;
|
||||
import org.apache.commons.lang.Validate;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.config.Config;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
|
@ -33,9 +33,9 @@ import io.github.thebusybiscuit.slimefun4.api.gps.Waypoint;
|
||||
import io.github.thebusybiscuit.slimefun4.api.items.HashedArmorpiece;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.GuideHistory;
|
||||
import io.github.thebusybiscuit.slimefun4.core.researching.Research;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
/**
|
||||
|
@ -2,7 +2,7 @@ package io.github.thebusybiscuit.slimefun4.core.attributes;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNet;
|
||||
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
|
||||
/**
|
||||
|
@ -11,8 +11,8 @@ import org.bukkit.persistence.PersistentDataType;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
|
||||
/**
|
||||
* This is just a simple helper class to provide static methods to the {@link Rechargeable}
|
||||
|
@ -6,9 +6,9 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.geo.GEOMiner;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.tools.GoldPan;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AGenerator;
|
||||
|
||||
@ -45,6 +45,6 @@ public interface RecipeDisplayItem extends ItemAttribute {
|
||||
}
|
||||
|
||||
default String getRecipeSectionLabel(Player p) {
|
||||
return "&7\u21E9 " + SlimefunPlugin.getLocal().getMessage(p, getLabelLocalPath()) + " \u21E9";
|
||||
return "&7\u21E9 " + SlimefunPlugin.getLocalization().getMessage(p, getLabelLocalPath()) + " \u21E9";
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
@ -15,7 +15,7 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.subcommands.Commands;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
/**
|
||||
* This {@link CommandExecutor} holds the functionality of our {@code /slimefun} command.
|
||||
|
@ -12,7 +12,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.core.researching.Research;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
|
||||
class SlimefunTabCompleter implements TabCompleter {
|
||||
|
@ -7,7 +7,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
/**
|
||||
* This class represents a {@link SubCommand}, it is a {@link Command} that starts with
|
||||
@ -53,10 +53,10 @@ public abstract class SubCommand {
|
||||
*/
|
||||
public String getDescription(CommandSender sender) {
|
||||
if (sender instanceof Player) {
|
||||
return SlimefunPlugin.getLocal().getMessage((Player) sender, getDescription());
|
||||
return SlimefunPlugin.getLocalization().getMessage((Player) sender, getDescription());
|
||||
}
|
||||
else {
|
||||
return SlimefunPlugin.getLocal().getMessage(getDescription());
|
||||
return SlimefunPlugin.getLocalization().getMessage(getDescription());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,8 +10,8 @@ import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
class BackpackCommand extends SubCommand {
|
||||
@ -38,17 +38,17 @@ class BackpackCommand extends SubCommand {
|
||||
@Override
|
||||
public void onExecute(CommandSender sender, String[] args) {
|
||||
if (!(sender instanceof Player) || !sender.hasPermission("slimefun.command.backpack")) {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.no-permission", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length != 3) {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.usage", true, msg -> msg.replace("%usage%", "/sf backpack <Player> <ID>"));
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.usage", true, msg -> msg.replace("%usage%", "/sf backpack <Player> <ID>"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!PatternUtils.NUMERIC.matcher(args[2]).matches()) {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "commands.backpack.invalid-id");
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "commands.backpack.invalid-id");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ class BackpackCommand extends SubCommand {
|
||||
OfflinePlayer backpackOwner = Bukkit.getOfflinePlayer(args[1]);
|
||||
|
||||
if (!(backpackOwner instanceof Player) && !backpackOwner.hasPlayedBefore()) {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "commands.backpack.player-never-joined");
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "commands.backpack.player-never-joined");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ class BackpackCommand extends SubCommand {
|
||||
|
||||
PlayerProfile.get(backpackOwner, profile -> {
|
||||
if (!profile.getBackpack(id).isPresent()) {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "commands.backpack.backpack-does-not-exist");
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "commands.backpack.backpack-does-not-exist");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ class BackpackCommand extends SubCommand {
|
||||
ItemStack item = SlimefunItems.RESTORED_BACKPACK.clone();
|
||||
SlimefunPlugin.getBackpackListener().setBackpackId(backpackOwner, item, 2, id);
|
||||
((Player) sender).getInventory().addItem(item);
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "commands.backpack.restored-backpack-given");
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "commands.backpack.restored-backpack-given");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import org.bukkit.entity.Player;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class CheatCommand extends SubCommand {
|
||||
|
||||
@ -31,11 +31,11 @@ class CheatCommand extends SubCommand {
|
||||
SlimefunGuide.openCheatMenu((Player) sender);
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.no-permission", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.only-players", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.only-players", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ import java.util.Collection;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
public final class Commands {
|
||||
|
||||
|
@ -6,7 +6,7 @@ import org.bukkit.entity.Player;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class DebugFishCommand extends SubCommand {
|
||||
|
||||
@ -30,7 +30,7 @@ class DebugFishCommand extends SubCommand {
|
||||
((Player) sender).getInventory().addItem(SlimefunItems.DEBUG_FISH);
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.no-permission", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,8 @@ import io.github.thebusybiscuit.cscorelib2.players.PlayerList;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
|
||||
class GiveCommand extends SubCommand {
|
||||
@ -50,36 +50,36 @@ class GiveCommand extends SubCommand {
|
||||
giveItem(sender, p, sfItem, args);
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.not-valid-item", true, msg -> msg.replace(PLACEHOLDER_ITEM, args[2]));
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.not-valid-item", true, msg -> msg.replace(PLACEHOLDER_ITEM, args[2]));
|
||||
}
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.not-online", true, msg -> msg.replace(PLACEHOLDER_PLAYER, args[1]));
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.not-online", true, msg -> msg.replace(PLACEHOLDER_PLAYER, args[1]));
|
||||
}
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.usage", true, msg -> msg.replace("%usage%", "/sf give <Player> <Slimefun Item> [Amount]"));
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.usage", true, msg -> msg.replace("%usage%", "/sf give <Player> <Slimefun Item> [Amount]"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.no-permission", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
|
||||
}
|
||||
}
|
||||
|
||||
private void giveItem(CommandSender sender, Player p, SlimefunItem sfItem, String[] args) {
|
||||
if (sfItem instanceof MultiBlockMachine) {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "guide.cheat.no-multiblocks");
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "guide.cheat.no-multiblocks");
|
||||
}
|
||||
else {
|
||||
int amount = parseAmount(args);
|
||||
|
||||
if (amount > 0) {
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "messages.given-item", true, msg -> msg.replace(PLACEHOLDER_ITEM, sfItem.getItemName()).replace(PLACEHOLDER_AMOUNT, String.valueOf(amount)));
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "messages.given-item", true, msg -> msg.replace(PLACEHOLDER_ITEM, sfItem.getItemName()).replace(PLACEHOLDER_AMOUNT, String.valueOf(amount)));
|
||||
p.getInventory().addItem(new CustomItem(sfItem.getItem(), amount));
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.give-item", true, msg -> msg.replace(PLACEHOLDER_PLAYER, args[1]).replace(PLACEHOLDER_ITEM, sfItem.getItemName()).replace(PLACEHOLDER_AMOUNT, String.valueOf(amount)));
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.give-item", true, msg -> msg.replace(PLACEHOLDER_PLAYER, args[1]).replace(PLACEHOLDER_ITEM, sfItem.getItemName()).replace(PLACEHOLDER_AMOUNT, String.valueOf(amount)));
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.not-valid-amount", true, msg -> msg.replace(PLACEHOLDER_AMOUNT, args[3]));
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.not-valid-amount", true, msg -> msg.replace(PLACEHOLDER_AMOUNT, args[3]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideLayout;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class GuideCommand extends SubCommand {
|
||||
|
||||
@ -32,11 +32,11 @@ class GuideCommand extends SubCommand {
|
||||
((Player) sender).getInventory().addItem(SlimefunGuide.getItem(SlimefunPlugin.getCfg().getBoolean("guide.default-view-book") ? SlimefunGuideLayout.BOOK : SlimefunGuideLayout.CHEST));
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.no-permission", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.only-players", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.only-players", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class HelpCommand extends SubCommand {
|
||||
|
||||
|
@ -7,7 +7,7 @@ import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideLayout;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class OpenGuideCommand extends SubCommand {
|
||||
|
||||
@ -33,11 +33,11 @@ class OpenGuideCommand extends SubCommand {
|
||||
SlimefunGuide.openGuide((Player) sender, book ? SlimefunGuideLayout.BOOK : SlimefunGuideLayout.CHEST);
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.no-permission", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.only-players", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.only-players", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.core.researching.Research;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class ResearchCommand extends SubCommand {
|
||||
|
||||
@ -60,13 +60,13 @@ class ResearchCommand extends SubCommand {
|
||||
});
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.not-online", true, msg -> msg.replace(PLACEHOLDER_PLAYER, args[1]));
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.not-online", true, msg -> msg.replace(PLACEHOLDER_PLAYER, args[1]));
|
||||
}
|
||||
}
|
||||
else SlimefunPlugin.getLocal().sendMessage(sender, "messages.no-permission", true);
|
||||
else SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.usage", true, msg -> msg.replace("%usage%", "/sf research <Player> <all/reset/Research>"));
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.usage", true, msg -> msg.replace("%usage%", "/sf research <Player> <all/reset/Research>"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,18 +76,18 @@ class ResearchCommand extends SubCommand {
|
||||
if (research.isPresent()) {
|
||||
research.get().unlock(p, true, player -> {
|
||||
UnaryOperator<String> variables = msg -> msg.replace(PLACEHOLDER_PLAYER, player.getName()).replace(PLACEHOLDER_RESEARCH, research.get().getName(player));
|
||||
SlimefunPlugin.getLocal().sendMessage(player, "messages.give-research", true, variables);
|
||||
SlimefunPlugin.getLocalization().sendMessage(player, "messages.give-research", true, variables);
|
||||
});
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.not-valid-research", true, msg -> msg.replace(PLACEHOLDER_RESEARCH, input));
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.not-valid-research", true, msg -> msg.replace(PLACEHOLDER_RESEARCH, input));
|
||||
}
|
||||
}
|
||||
|
||||
private void researchAll(CommandSender sender, PlayerProfile profile, Player p) {
|
||||
for (Research res : SlimefunPlugin.getRegistry().getResearches()) {
|
||||
if (!profile.hasUnlocked(res)) {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.give-research", true, msg -> msg.replace(PLACEHOLDER_PLAYER, p.getName()).replace(PLACEHOLDER_RESEARCH, res.getName(p)));
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.give-research", true, msg -> msg.replace(PLACEHOLDER_PLAYER, p.getName()).replace(PLACEHOLDER_RESEARCH, res.getName(p)));
|
||||
}
|
||||
|
||||
res.unlock(p, true);
|
||||
@ -99,7 +99,7 @@ class ResearchCommand extends SubCommand {
|
||||
profile.setResearched(research, false);
|
||||
}
|
||||
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "commands.research.reset", true, msg -> msg.replace(PLACEHOLDER_PLAYER, p.getName()));
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "commands.research.reset", true, msg -> msg.replace(PLACEHOLDER_PLAYER, p.getName()));
|
||||
}
|
||||
|
||||
private Optional<Research> getResearchFromString(String input) {
|
||||
|
@ -9,7 +9,7 @@ import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class SearchCommand extends SubCommand {
|
||||
|
||||
@ -36,15 +36,15 @@ class SearchCommand extends SubCommand {
|
||||
PlayerProfile.get((Player) sender, profile -> SlimefunGuide.openSearch(profile, query, true, true));
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.usage", true, msg -> msg.replace("%usage%", "/sf search <SearchTerm>"));
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.usage", true, msg -> msg.replace("%usage%", "/sf search <SearchTerm>"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.no-permission", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.only-players", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.only-players", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ import io.github.thebusybiscuit.cscorelib2.players.PlayerList;
|
||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class StatsCommand extends SubCommand {
|
||||
|
||||
@ -38,16 +38,16 @@ class StatsCommand extends SubCommand {
|
||||
PlayerProfile.get(player.get(), profile -> profile.sendStats(sender));
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.not-online", true, msg -> msg.replace("%player%", args[1]));
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.not-online", true, msg -> msg.replace("%player%", args[1]));
|
||||
}
|
||||
}
|
||||
else SlimefunPlugin.getLocal().sendMessage(sender, "messages.no-permission", true);
|
||||
else SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
|
||||
}
|
||||
else if (sender instanceof Player) {
|
||||
PlayerProfile.get((Player) sender, profile -> profile.sendStats(sender));
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.only-players", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.only-players", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class TeleporterCommand extends SubCommand {
|
||||
|
||||
@ -43,19 +43,19 @@ class TeleporterCommand extends SubCommand {
|
||||
SlimefunPlugin.getGPSNetwork().getTeleportationManager().openTeleporterGUI((Player) sender, player.getUniqueId(), ((Player) sender).getLocation().getBlock().getRelative(BlockFace.DOWN), 999999999);
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.unknown-player", msg -> msg.replace("%player%", args[1]));
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.unknown-player", msg -> msg.replace("%player%", args[1]));
|
||||
}
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.usage", msg -> msg.replace("%usage%", "/sf teleporter [Player]"));
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.usage", msg -> msg.replace("%usage%", "/sf teleporter [Player]"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.no-permission");
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission");
|
||||
}
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.only-players");
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.only-players");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ import org.bukkit.command.ConsoleCommandSender;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class TimingsCommand extends SubCommand {
|
||||
|
||||
@ -26,10 +26,10 @@ class TimingsCommand extends SubCommand {
|
||||
@Override
|
||||
public void onExecute(CommandSender sender, String[] args) {
|
||||
if (sender.hasPermission("slimefun.command.timings") || sender instanceof ConsoleCommandSender) {
|
||||
SlimefunPlugin.getTicker().info(sender);
|
||||
SlimefunPlugin.getTickerTask().info(sender);
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.no-permission", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
|
||||
import io.github.thebusybiscuit.cscorelib2.reflection.ReflectionUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class VersionsCommand extends SubCommand {
|
||||
|
||||
@ -57,7 +57,7 @@ class VersionsCommand extends SubCommand {
|
||||
}
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.no-permission", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,10 +12,10 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
|
||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.guide.BookSlimefunGuide;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.guide.ChestSlimefunGuide;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
@ -102,7 +102,7 @@ public final class SlimefunGuide {
|
||||
|
||||
private static void openMainMenuAsync(Player player, SlimefunGuideLayout layout, int selectedPage) {
|
||||
if (!PlayerProfile.get(player, profile -> Slimefun.runSync(() -> openMainMenu(profile, layout, selectedPage)))) {
|
||||
SlimefunPlugin.getLocal().sendMessage(player, "messages.opening-guide");
|
||||
SlimefunPlugin.getLocalization().sendMessage(player, "messages.opening-guide");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,9 +8,9 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import io.github.thebusybiscuit.slimefun4.core.researching.Research;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.guide.BookSlimefunGuide;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.guide.ChestSlimefunGuide;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
|
||||
|
@ -14,26 +14,26 @@ import org.bukkit.inventory.meta.SkullMeta;
|
||||
import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.github.Contributor;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
|
||||
final class ContributorsMenu {
|
||||
|
||||
private ContributorsMenu() {}
|
||||
|
||||
public static void open(Player p, int page) {
|
||||
ChestMenu menu = new ChestMenu(SlimefunPlugin.getLocal().getMessage(p, "guide.title.credits"));
|
||||
ChestMenu menu = new ChestMenu(SlimefunPlugin.getLocalization().getMessage(p, "guide.title.credits"));
|
||||
|
||||
menu.setEmptySlotsClickable(false);
|
||||
menu.addMenuOpeningHandler(pl -> pl.playSound(pl.getLocation(), Sound.BLOCK_NOTE_BLOCK_HARP, 0.7F, 0.7F));
|
||||
|
||||
ChestMenuUtils.drawBackground(menu, 0, 2, 3, 4, 5, 6, 7, 8, 45, 47, 48, 49, 50, 51, 52);
|
||||
|
||||
menu.addItem(1, new CustomItem(ChestMenuUtils.getBackButton(p, "", "&7" + SlimefunPlugin.getLocal().getMessage(p, "guide.back.settings"))));
|
||||
menu.addItem(1, new CustomItem(ChestMenuUtils.getBackButton(p, "", "&7" + SlimefunPlugin.getLocalization().getMessage(p, "guide.back.settings"))));
|
||||
menu.addMenuClickHandler(1, (pl, slot, item, action) -> {
|
||||
SlimefunGuideSettings.openSettings(pl, p.getInventory().getItemInMainHand());
|
||||
return false;
|
||||
@ -87,15 +87,15 @@ final class ContributorsMenu {
|
||||
|
||||
if (!info.startsWith("&")) {
|
||||
String[] segments = PatternUtils.COMMA.split(info);
|
||||
info = SlimefunPlugin.getLocal().getMessage(p, "guide.credits.roles." + segments[0]);
|
||||
info = SlimefunPlugin.getLocalization().getMessage(p, "guide.credits.roles." + segments[0]);
|
||||
|
||||
if (segments.length == 2) {
|
||||
info += " &7(" + SlimefunPlugin.getLocal().getMessage(p, "languages." + segments[1]) + ')';
|
||||
info += " &7(" + SlimefunPlugin.getLocalization().getMessage(p, "languages." + segments[1]) + ')';
|
||||
}
|
||||
}
|
||||
|
||||
if (entry.getValue() > 0) {
|
||||
String commits = SlimefunPlugin.getLocal().getMessage(p, "guide.credits." + (entry.getValue() > 1 ? "commits" : "commit"));
|
||||
String commits = SlimefunPlugin.getLocalization().getMessage(p, "guide.credits." + (entry.getValue() > 1 ? "commits" : "commit"));
|
||||
|
||||
info += " &7(" + entry.getValue() + ' ' + commits + ')';
|
||||
}
|
||||
@ -105,7 +105,7 @@ final class ContributorsMenu {
|
||||
|
||||
if (contributor.getProfile() != null) {
|
||||
lore.add("");
|
||||
lore.add(ChatColors.color("&7\u21E8 &e") + SlimefunPlugin.getLocal().getMessage(p, "guide.credits.profile-link"));
|
||||
lore.add(ChatColors.color("&7\u21E8 &e") + SlimefunPlugin.getLocalization().getMessage(p, "guide.credits.profile-link"));
|
||||
}
|
||||
|
||||
meta.setLore(lore);
|
||||
|
@ -10,7 +10,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import io.github.thebusybiscuit.cscorelib2.data.PersistentDataAPI;
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class FireworksOption implements SlimefunGuideOption<Boolean> {
|
||||
|
||||
|
@ -14,9 +14,9 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideLayout;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
|
||||
class GuideLayoutOption implements SlimefunGuideOption<SlimefunGuideLayout> {
|
||||
|
||||
|
@ -13,11 +13,11 @@ import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
|
||||
import io.github.thebusybiscuit.slimefun4.api.events.PlayerLanguageChangeEvent;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
|
||||
class PlayerLanguageOption implements SlimefunGuideOption<String> {
|
||||
|
||||
@ -28,16 +28,16 @@ class PlayerLanguageOption implements SlimefunGuideOption<String> {
|
||||
|
||||
@Override
|
||||
public NamespacedKey getKey() {
|
||||
return SlimefunPlugin.getLocal().getKey();
|
||||
return SlimefunPlugin.getLocalization().getKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<ItemStack> getDisplayItem(Player p, ItemStack guide) {
|
||||
if (SlimefunPlugin.getLocal().isEnabled()) {
|
||||
Language language = SlimefunPlugin.getLocal().getLanguage(p);
|
||||
String languageName = language.isDefault() ? (SlimefunPlugin.getLocal().getMessage(p, "languages.default") + ChatColor.DARK_GRAY + " (" + language.getName(p) + ")") : SlimefunPlugin.getLocal().getMessage(p, "languages." + language.getId());
|
||||
if (SlimefunPlugin.getLocalization().isEnabled()) {
|
||||
Language language = SlimefunPlugin.getLocalization().getLanguage(p);
|
||||
String languageName = language.isDefault() ? (SlimefunPlugin.getLocalization().getMessage(p, "languages.default") + ChatColor.DARK_GRAY + " (" + language.getName(p) + ")") : SlimefunPlugin.getLocalization().getMessage(p, "languages." + language.getId());
|
||||
|
||||
return Optional.of(new CustomItem(language.getItem(), "&7" + SlimefunPlugin.getLocal().getMessage(p, "guide.languages.selected-language") + " &a" + languageName, "", "&7You now have the option to change", "&7the language in which Slimefun", "&7will send you messages.", "&7Note that this only translates", "&7some messages, not items.", "&7&oThis feature is still being worked on", "", "&7\u21E8 &eClick to change your language"));
|
||||
return Optional.of(new CustomItem(language.getItem(), "&7" + SlimefunPlugin.getLocalization().getMessage(p, "guide.languages.selected-language") + " &a" + languageName, "", "&7You now have the option to change", "&7the language in which Slimefun", "&7will send you messages.", "&7Note that this only translates", "&7some messages, not items.", "&7&oThis feature is still being worked on", "", "&7\u21E8 &eClick to change your language"));
|
||||
}
|
||||
else {
|
||||
return Optional.empty();
|
||||
@ -51,7 +51,7 @@ class PlayerLanguageOption implements SlimefunGuideOption<String> {
|
||||
|
||||
@Override
|
||||
public Optional<String> getSelectedOption(Player p, ItemStack guide) {
|
||||
return Optional.of(SlimefunPlugin.getLocal().getLanguage(p).getId());
|
||||
return Optional.of(SlimefunPlugin.getLocalization().getLanguage(p).getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -65,20 +65,20 @@ class PlayerLanguageOption implements SlimefunGuideOption<String> {
|
||||
}
|
||||
|
||||
private void openLanguageSelection(Player p, ItemStack guide) {
|
||||
ChestMenu menu = new ChestMenu(SlimefunPlugin.getLocal().getMessage(p, "guide.title.languages"));
|
||||
ChestMenu menu = new ChestMenu(SlimefunPlugin.getLocalization().getMessage(p, "guide.title.languages"));
|
||||
|
||||
menu.setEmptySlotsClickable(false);
|
||||
menu.addMenuOpeningHandler(pl -> pl.playSound(pl.getLocation(), Sound.BLOCK_NOTE_BLOCK_HARP, 0.7F, 0.7F));
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
if (i == 1) {
|
||||
menu.addItem(1, ChestMenuUtils.getBackButton(p, "", "&7" + SlimefunPlugin.getLocal().getMessage(p, "guide.back.settings")), (pl, slot, item, action) -> {
|
||||
menu.addItem(1, ChestMenuUtils.getBackButton(p, "", "&7" + SlimefunPlugin.getLocalization().getMessage(p, "guide.back.settings")), (pl, slot, item, action) -> {
|
||||
SlimefunGuideSettings.openSettings(pl, guide);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
else if (i == 7) {
|
||||
menu.addItem(7, new CustomItem(SlimefunUtils.getCustomHead("3edd20be93520949e6ce789dc4f43efaeb28c717ee6bfcbbe02780142f716"), SlimefunPlugin.getLocal().getMessage(p, "guide.languages.translations.name"), "", "&7\u21E8 &e" + SlimefunPlugin.getLocal().getMessage(p, "guide.languages.translations.lore")), (pl, slot, item, action) -> {
|
||||
menu.addItem(7, new CustomItem(SlimefunUtils.getCustomHead("3edd20be93520949e6ce789dc4f43efaeb28c717ee6bfcbbe02780142f716"), SlimefunPlugin.getLocalization().getMessage(p, "guide.languages.translations.name"), "", "&7\u21E8 &e" + SlimefunPlugin.getLocalization().getMessage(p, "guide.languages.translations.lore")), (pl, slot, item, action) -> {
|
||||
ChatUtils.sendURL(pl, "https://github.com/TheBusyBiscuit/Slimefun4/wiki/Translating-Slimefun");
|
||||
pl.closeInventory();
|
||||
return false;
|
||||
@ -89,14 +89,14 @@ class PlayerLanguageOption implements SlimefunGuideOption<String> {
|
||||
}
|
||||
}
|
||||
|
||||
Language defaultLanguage = SlimefunPlugin.getLocal().getDefaultLanguage();
|
||||
String defaultLanguageString = SlimefunPlugin.getLocal().getMessage(p, "languages.default");
|
||||
Language defaultLanguage = SlimefunPlugin.getLocalization().getDefaultLanguage();
|
||||
String defaultLanguageString = SlimefunPlugin.getLocalization().getMessage(p, "languages.default");
|
||||
|
||||
menu.addItem(9, new CustomItem(defaultLanguage.getItem(), ChatColor.GRAY + defaultLanguageString + ChatColor.DARK_GRAY + " (" + defaultLanguage.getName(p) + ")", "", "&7\u21E8 &e" + SlimefunPlugin.getLocal().getMessage(p, "guide.languages.select-default")), (pl, i, item, action) -> {
|
||||
SlimefunPlugin.instance.getServer().getPluginManager().callEvent(new PlayerLanguageChangeEvent(pl, SlimefunPlugin.getLocal().getLanguage(pl), defaultLanguage));
|
||||
menu.addItem(9, new CustomItem(defaultLanguage.getItem(), ChatColor.GRAY + defaultLanguageString + ChatColor.DARK_GRAY + " (" + defaultLanguage.getName(p) + ")", "", "&7\u21E8 &e" + SlimefunPlugin.getLocalization().getMessage(p, "guide.languages.select-default")), (pl, i, item, action) -> {
|
||||
SlimefunPlugin.instance.getServer().getPluginManager().callEvent(new PlayerLanguageChangeEvent(pl, SlimefunPlugin.getLocalization().getLanguage(pl), defaultLanguage));
|
||||
setSelectedOption(pl, guide, null);
|
||||
|
||||
SlimefunPlugin.getLocal().sendMessage(pl, "guide.languages.updated", msg -> msg.replace("%lang%", defaultLanguageString));
|
||||
SlimefunPlugin.getLocalization().sendMessage(pl, "guide.languages.updated", msg -> msg.replace("%lang%", defaultLanguageString));
|
||||
|
||||
SlimefunGuideSettings.openSettings(pl, guide);
|
||||
return false;
|
||||
@ -104,13 +104,13 @@ class PlayerLanguageOption implements SlimefunGuideOption<String> {
|
||||
|
||||
int slot = 10;
|
||||
|
||||
for (Language language : SlimefunPlugin.getLocal().getLanguages()) {
|
||||
menu.addItem(slot, new CustomItem(language.getItem(), ChatColor.GREEN + language.getName(p), "&b" + SlimefunPlugin.getLocal().getProgress(language) + '%', "", "&7\u21E8 &e" + SlimefunPlugin.getLocal().getMessage(p, "guide.languages.select")), (pl, i, item, action) -> {
|
||||
SlimefunPlugin.instance.getServer().getPluginManager().callEvent(new PlayerLanguageChangeEvent(pl, SlimefunPlugin.getLocal().getLanguage(pl), language));
|
||||
for (Language language : SlimefunPlugin.getLocalization().getLanguages()) {
|
||||
menu.addItem(slot, new CustomItem(language.getItem(), ChatColor.GREEN + language.getName(p), "&b" + SlimefunPlugin.getLocalization().getProgress(language) + '%', "", "&7\u21E8 &e" + SlimefunPlugin.getLocalization().getMessage(p, "guide.languages.select")), (pl, i, item, action) -> {
|
||||
SlimefunPlugin.instance.getServer().getPluginManager().callEvent(new PlayerLanguageChangeEvent(pl, SlimefunPlugin.getLocalization().getLanguage(pl), language));
|
||||
setSelectedOption(pl, guide, language.getId());
|
||||
|
||||
String name = language.getName(pl);
|
||||
SlimefunPlugin.getLocal().sendMessage(pl, "guide.languages.updated", msg -> msg.replace("%lang%", name));
|
||||
SlimefunPlugin.getLocalization().sendMessage(pl, "guide.languages.updated", msg -> msg.replace("%lang%", name));
|
||||
|
||||
SlimefunGuideSettings.openSettings(pl, guide);
|
||||
return false;
|
||||
|
@ -15,12 +15,12 @@ import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideLayout;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
|
||||
/**
|
||||
* This static utility class offers various methods that provide access to the
|
||||
@ -54,7 +54,7 @@ public final class SlimefunGuideSettings {
|
||||
}
|
||||
|
||||
public static void openSettings(Player p, ItemStack guide) {
|
||||
ChestMenu menu = new ChestMenu(SlimefunPlugin.getLocal().getMessage(p, "guide.title.settings"));
|
||||
ChestMenu menu = new ChestMenu(SlimefunPlugin.getLocalization().getMessage(p, "guide.title.settings"));
|
||||
|
||||
menu.setEmptySlotsClickable(false);
|
||||
menu.addMenuOpeningHandler(pl -> pl.playSound(pl.getLocation(), Sound.BLOCK_NOTE_BLOCK_HARP, 0.7F, 0.7F));
|
||||
@ -68,39 +68,39 @@ public final class SlimefunGuideSettings {
|
||||
}
|
||||
|
||||
private static void addHeader(Player p, ChestMenu menu, ItemStack guide) {
|
||||
menu.addItem(0, new CustomItem(SlimefunGuide.getItem(SlimefunGuideLayout.CHEST), "&e\u21E6 " + SlimefunPlugin.getLocal().getMessage(p, "guide.back.title"), "", "&7" + SlimefunPlugin.getLocal().getMessage(p, "guide.back.guide")), (pl, slot, item, action) -> {
|
||||
menu.addItem(0, new CustomItem(SlimefunGuide.getItem(SlimefunGuideLayout.CHEST), "&e\u21E6 " + SlimefunPlugin.getLocalization().getMessage(p, "guide.back.title"), "", "&7" + SlimefunPlugin.getLocalization().getMessage(p, "guide.back.guide")), (pl, slot, item, action) -> {
|
||||
SlimefunGuide.openGuide(pl, guide);
|
||||
return false;
|
||||
});
|
||||
|
||||
menu.addItem(2, new CustomItem(SlimefunUtils.getCustomHead("e952d2b3f351a6b0487cc59db31bf5f2641133e5ba0006b18576e996a0293e52"), "&c" + SlimefunPlugin.getLocal().getMessage(p, "guide.title.credits"), "", "&7Contributors: &e" + SlimefunPlugin.getGitHubService().getContributors().size(), "", "&7Slimefun is an open-source project", "&7and maintained by a large community of people.", "&7Here you can see who helped shape the project.", "", "&7\u21E8 &eClick to see our contributors"), (pl, slot, action, item) -> {
|
||||
menu.addItem(2, new CustomItem(SlimefunUtils.getCustomHead("e952d2b3f351a6b0487cc59db31bf5f2641133e5ba0006b18576e996a0293e52"), "&c" + SlimefunPlugin.getLocalization().getMessage(p, "guide.title.credits"), "", "&7Contributors: &e" + SlimefunPlugin.getGitHubService().getContributors().size(), "", "&7Slimefun is an open-source project", "&7and maintained by a large community of people.", "&7Here you can see who helped shape the project.", "", "&7\u21E8 &eClick to see our contributors"), (pl, slot, action, item) -> {
|
||||
ContributorsMenu.open(pl, 0);
|
||||
return false;
|
||||
});
|
||||
|
||||
menu.addItem(4, new CustomItem(Material.WRITABLE_BOOK, "&aSlimefun Version", "&7&o" + SlimefunPlugin.getLocal().getMessage(p, "guide.tooltips.versions-notice"), "", "&fMinecraft Version: &a" + Bukkit.getBukkitVersion(), "&fSlimefun Version: &a" + SlimefunPlugin.getVersion(), "&fCS-CoreLib Version: &a" + SlimefunPlugin.getCSCoreLibVersion()), ChestMenuUtils.getEmptyClickHandler());
|
||||
menu.addItem(4, new CustomItem(Material.WRITABLE_BOOK, "&aSlimefun Version", "&7&o" + SlimefunPlugin.getLocalization().getMessage(p, "guide.tooltips.versions-notice"), "", "&fMinecraft Version: &a" + Bukkit.getBukkitVersion(), "&fSlimefun Version: &a" + SlimefunPlugin.getVersion(), "&fCS-CoreLib Version: &a" + SlimefunPlugin.getCSCoreLibVersion()), ChestMenuUtils.getEmptyClickHandler());
|
||||
|
||||
menu.addItem(6, new CustomItem(Material.COMPARATOR, "&e" + SlimefunPlugin.getLocal().getMessage(p, "guide.title.source"), "", "&7Last Activity: &a" + NumberUtils.getElapsedTime(SlimefunPlugin.getGitHubService().getLastUpdate()) + " ago", "&7Forks: &e" + SlimefunPlugin.getGitHubService().getForks(), "&7Stars: &e" + SlimefunPlugin.getGitHubService().getStars(), "", "&7&oSlimefun 4 is a community project,", "&7&othe source code is available on GitHub", "&7&oand if you want to keep this Plugin alive,", "&7&othen please consider contributing to it", "", "&7\u21E8 &eClick to go to GitHub"));
|
||||
menu.addItem(6, new CustomItem(Material.COMPARATOR, "&e" + SlimefunPlugin.getLocalization().getMessage(p, "guide.title.source"), "", "&7Last Activity: &a" + NumberUtils.getElapsedTime(SlimefunPlugin.getGitHubService().getLastUpdate()) + " ago", "&7Forks: &e" + SlimefunPlugin.getGitHubService().getForks(), "&7Stars: &e" + SlimefunPlugin.getGitHubService().getStars(), "", "&7&oSlimefun 4 is a community project,", "&7&othe source code is available on GitHub", "&7&oand if you want to keep this Plugin alive,", "&7&othen please consider contributing to it", "", "&7\u21E8 &eClick to go to GitHub"));
|
||||
menu.addMenuClickHandler(6, (pl, slot, item, action) -> {
|
||||
pl.closeInventory();
|
||||
ChatUtils.sendURL(pl, "https://github.com/TheBusyBiscuit/Slimefun4");
|
||||
return false;
|
||||
});
|
||||
|
||||
menu.addItem(8, new CustomItem(Material.KNOWLEDGE_BOOK, "&3" + SlimefunPlugin.getLocal().getMessage(p, "guide.title.wiki"), "", "&7Do you need help with an Item or machine?", "&7You cannot figure out what to do?", "&7Check out our community-maintained Wiki", "&7and become one of our Editors!", "", "&7\u21E8 &eClick to go to the official Slimefun Wiki"), (pl, slot, item, action) -> {
|
||||
menu.addItem(8, new CustomItem(Material.KNOWLEDGE_BOOK, "&3" + SlimefunPlugin.getLocalization().getMessage(p, "guide.title.wiki"), "", "&7Do you need help with an Item or machine?", "&7You cannot figure out what to do?", "&7Check out our community-maintained Wiki", "&7and become one of our Editors!", "", "&7\u21E8 &eClick to go to the official Slimefun Wiki"), (pl, slot, item, action) -> {
|
||||
pl.closeInventory();
|
||||
ChatUtils.sendURL(pl, "https://github.com/TheBusyBiscuit/Slimefun4/wiki");
|
||||
return false;
|
||||
});
|
||||
|
||||
menu.addItem(47, new CustomItem(Material.BOOKSHELF, "&3" + SlimefunPlugin.getLocal().getMessage(p, "guide.title.addons"), "", "&7Slimefun is huge. But its addons are what makes", "&7this plugin truly shine. Go check them out, some", "&7of them may be exactly what you were missing out on!", "", "&7Installed on this Server: &b" + SlimefunPlugin.getInstalledAddons().size(), "", "&7\u21E8 &eClick to see all available Addons for Slimefun4"), (pl, slot, item, action) -> {
|
||||
menu.addItem(47, new CustomItem(Material.BOOKSHELF, "&3" + SlimefunPlugin.getLocalization().getMessage(p, "guide.title.addons"), "", "&7Slimefun is huge. But its addons are what makes", "&7this plugin truly shine. Go check them out, some", "&7of them may be exactly what you were missing out on!", "", "&7Installed on this Server: &b" + SlimefunPlugin.getInstalledAddons().size(), "", "&7\u21E8 &eClick to see all available Addons for Slimefun4"), (pl, slot, item, action) -> {
|
||||
pl.closeInventory();
|
||||
ChatUtils.sendURL(pl, "https://github.com/TheBusyBiscuit/Slimefun4/wiki/Addons");
|
||||
return false;
|
||||
});
|
||||
|
||||
if (SlimefunPlugin.getUpdater().getBranch().isOfficial()) {
|
||||
menu.addItem(49, new CustomItem(Material.REDSTONE_TORCH, "&4" + SlimefunPlugin.getLocal().getMessage(p, "guide.title.bugs"), "", "&7&oBug reports have to be made in English!", "", "&7Open Issues: &a" + SlimefunPlugin.getGitHubService().getOpenissues(), "&7Pending Pull Requests: &a" + SlimefunPlugin.getGitHubService().getPendingPullRequests(), "", "&7\u21E8 &eClick to go to the Slimefun4 Bug Tracker"), (pl, slot, item, action) -> {
|
||||
menu.addItem(49, new CustomItem(Material.REDSTONE_TORCH, "&4" + SlimefunPlugin.getLocalization().getMessage(p, "guide.title.bugs"), "", "&7&oBug reports have to be made in English!", "", "&7Open Issues: &a" + SlimefunPlugin.getGitHubService().getOpenissues(), "&7Pending Pull Requests: &a" + SlimefunPlugin.getGitHubService().getPendingPullRequests(), "", "&7\u21E8 &eClick to go to the Slimefun4 Bug Tracker"), (pl, slot, item, action) -> {
|
||||
pl.closeInventory();
|
||||
ChatUtils.sendURL(pl, "https://github.com/TheBusyBiscuit/Slimefun4/issues");
|
||||
return false;
|
||||
|
@ -13,7 +13,7 @@ import org.bukkit.block.BlockFace;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.api.events.MultiBlockInteractEvent;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.Objects.handlers.MultiBlockInteractionHandler;
|
||||
|
||||
|
@ -20,7 +20,7 @@ import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
|
||||
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.NotPlaceable;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
|
@ -19,9 +19,9 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.network.Network;
|
||||
import io.github.thebusybiscuit.slimefun4.api.network.NetworkComponent;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.holograms.SimpleHologram;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.DirtyChestMenu;
|
||||
|
@ -16,10 +16,10 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.blocks.BlockPosition;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
|
||||
@ -338,7 +338,7 @@ final class CargoUtils {
|
||||
return stack != null && Tag.LOGS.isTagged(stack.getType());
|
||||
}
|
||||
else {
|
||||
return SlimefunPlugin.getMinecraftRecipes().isSmeltable(stack);
|
||||
return SlimefunPlugin.getMinecraftRecipeService().isSmeltable(stack);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,10 +26,10 @@ import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.cscorelib2.math.DoubleHandler;
|
||||
import io.github.thebusybiscuit.slimefun4.api.network.Network;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.DirtyChestMenu;
|
||||
|
@ -13,10 +13,10 @@ import io.github.thebusybiscuit.slimefun4.api.ErrorReport;
|
||||
import io.github.thebusybiscuit.slimefun4.api.network.Network;
|
||||
import io.github.thebusybiscuit.slimefun4.api.network.NetworkComponent;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.reactors.Reactor;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.holograms.SimpleHologram;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.Objects.handlers.GeneratorTicker;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
@ -247,7 +247,7 @@ public class EnergyNet extends Network {
|
||||
new ErrorReport(t, source, item);
|
||||
}
|
||||
|
||||
SlimefunPlugin.getTicker().addBlockTimings(source, System.currentTimeMillis() - timestamp);
|
||||
SlimefunPlugin.getTickerTask().addBlockTimings(source, System.currentTimeMillis() - timestamp);
|
||||
}
|
||||
else {
|
||||
// This block seems to be gone now, better remove it to be extra safe
|
||||
|
@ -18,9 +18,9 @@ import io.github.thebusybiscuit.slimefun4.api.events.ResearchUnlockEvent;
|
||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.options.SlimefunGuideSettings;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.setup.ResearchSetup;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.FireworkUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
@ -110,7 +110,7 @@ public class Research implements Keyed {
|
||||
* @return The localized Name of this {@link Research}.
|
||||
*/
|
||||
public String getName(Player p) {
|
||||
String localized = SlimefunPlugin.getLocal().getResearchName(p, key);
|
||||
String localized = SlimefunPlugin.getLocalization().getResearchName(p, key);
|
||||
return localized != null ? localized : name;
|
||||
}
|
||||
|
||||
@ -222,7 +222,7 @@ public class Research implements Keyed {
|
||||
if (!instant) {
|
||||
Slimefun.runSync(() -> {
|
||||
p.playSound(p.getLocation(), Sound.ENTITY_BAT_TAKEOFF, 0.7F, 1F);
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "messages.research.progress", true, msg -> msg.replace(PLACEHOLDER_RESEARCH, getName(p)).replace("%progress%", "0%"));
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "messages.research.progress", true, msg -> msg.replace(PLACEHOLDER_RESEARCH, getName(p)).replace("%progress%", "0%"));
|
||||
}, 10L);
|
||||
}
|
||||
PlayerProfile.get(p, profile -> {
|
||||
@ -235,7 +235,7 @@ public class Research implements Keyed {
|
||||
finishResearch(p, profile, callback);
|
||||
}
|
||||
else if (SlimefunPlugin.getRegistry().getCurrentlyResearchingPlayers().add(p.getUniqueId())) {
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "messages.research.start", true, msg -> msg.replace(PLACEHOLDER_RESEARCH, getName(p)));
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "messages.research.start", true, msg -> msg.replace(PLACEHOLDER_RESEARCH, getName(p)));
|
||||
playResearchAnimation(p);
|
||||
|
||||
Slimefun.runSync(() -> {
|
||||
@ -251,7 +251,7 @@ public class Research implements Keyed {
|
||||
|
||||
private void finishResearch(Player p, PlayerProfile profile, Consumer<Player> callback) {
|
||||
profile.setResearched(this, true);
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "messages.unlocked", true, msg -> msg.replace(PLACEHOLDER_RESEARCH, getName(p)));
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "messages.unlocked", true, msg -> msg.replace(PLACEHOLDER_RESEARCH, getName(p)));
|
||||
callback.accept(p);
|
||||
|
||||
if (SlimefunPlugin.getRegistry().isResearchFireworkEnabled() && SlimefunGuideSettings.hasFireworksEnabled(p)) {
|
||||
@ -265,7 +265,7 @@ public class Research implements Keyed {
|
||||
|
||||
Slimefun.runSync(() -> {
|
||||
p.playSound(p.getLocation(), Sound.ENTITY_BAT_TAKEOFF, 0.7F, 1F);
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "messages.research.progress", true, msg -> msg.replace(PLACEHOLDER_RESEARCH, getName(p)).replace("%progress%", RESEARCH_PROGRESS[j - 1] + "%"));
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "messages.research.progress", true, msg -> msg.replace(PLACEHOLDER_RESEARCH, getName(p)).replace("%progress%", RESEARCH_PROGRESS[j - 1] + "%"));
|
||||
}, i * 20L);
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
|
@ -15,7 +15,7 @@ import java.util.logging.Level;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
/**
|
||||
|
@ -12,7 +12,7 @@ import org.bukkit.persistence.PersistentDataHolder;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
/**
|
||||
* The {@link BlockDataService} is similar to the {@link CustomItemDataService},
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.config.Config;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
||||
|
@ -19,7 +19,7 @@ import org.bukkit.entity.Player;
|
||||
import io.github.thebusybiscuit.cscorelib2.math.DoubleHandler;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.localization.SlimefunLocalization;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
/**
|
||||
|
@ -21,7 +21,7 @@ import io.github.thebusybiscuit.cscorelib2.collections.OptionalMap;
|
||||
import io.github.thebusybiscuit.cscorelib2.config.Config;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
|
||||
/**
|
||||
|
@ -12,7 +12,7 @@ import org.bukkit.permissions.Permissible;
|
||||
import org.bukkit.permissions.Permission;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.config.Config;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
|
||||
/**
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.persistence.PersistentDataHolder;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
/**
|
||||
* This interface is used to defer calls to Persistent Data and make sure they are only called
|
||||
|
@ -9,8 +9,8 @@ import io.github.thebusybiscuit.cscorelib2.config.Config;
|
||||
import io.github.thebusybiscuit.cscorelib2.updater.GitHubBuildsUpdater;
|
||||
import io.github.thebusybiscuit.cscorelib2.updater.Updater;
|
||||
import io.github.thebusybiscuit.slimefun4.api.SlimefunBranch;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
|
||||
/**
|
||||
* This Class represents our {@link Updater} Service.
|
||||
|
@ -16,7 +16,7 @@ import java.util.logging.Level;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
abstract class GitHubConnector {
|
||||
|
@ -14,8 +14,8 @@ import com.google.gson.JsonObject;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.config.Config;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.localization.Translators;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
|
||||
/**
|
||||
* This Service is responsible for grabbing every {@link Contributor} to this project
|
||||
|
@ -11,7 +11,7 @@ import org.bukkit.Bukkit;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.players.MinecraftAccount;
|
||||
import io.github.thebusybiscuit.cscorelib2.players.MinecraftAccount.TooManyRequestsException;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
/**
|
||||
|
@ -10,8 +10,8 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.LocalizationService;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
|
||||
/**
|
||||
* This Class represents a {@link Language} that Slimefun can recognize and use.
|
||||
@ -129,7 +129,7 @@ public final class Language {
|
||||
* @return The localized name of this {@link Language}
|
||||
*/
|
||||
public String getName(Player p) {
|
||||
String name = SlimefunPlugin.getLocal().getMessage(p, "languages." + id);
|
||||
String name = SlimefunPlugin.getLocalization().getMessage(p, "languages." + id);
|
||||
return name != null ? name : toString();
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ public final class Language {
|
||||
* @return Whether this is the default {@link Language} of this {@link Server}
|
||||
*/
|
||||
public boolean isDefault() {
|
||||
return this == SlimefunPlugin.getLocal().getDefaultLanguage();
|
||||
return this == SlimefunPlugin.getLocalization().getDefaultLanguage();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,7 +21,7 @@ import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.api.SlimefunBranch;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.LocalizationService;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
|
||||
/**
|
||||
|
@ -6,7 +6,7 @@ import java.util.Map;
|
||||
import org.bstats.bukkit.Metrics.AdvancedPie;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class AddonsChart extends AdvancedPie {
|
||||
|
||||
|
@ -2,7 +2,7 @@ package io.github.thebusybiscuit.slimefun4.core.services.metrics;
|
||||
|
||||
import org.bstats.bukkit.Metrics.SimplePie;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class AutoUpdaterChart extends SimplePie {
|
||||
|
||||
|
@ -6,7 +6,7 @@ import java.util.Map;
|
||||
import org.bstats.bukkit.Metrics.AdvancedPie;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class CommandChart extends AdvancedPie {
|
||||
|
||||
|
@ -2,7 +2,7 @@ package io.github.thebusybiscuit.slimefun4.core.services.metrics;
|
||||
|
||||
import org.bstats.bukkit.Metrics.SimplePie;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class CompatibilityModeChart extends SimplePie {
|
||||
|
||||
|
@ -2,7 +2,7 @@ package io.github.thebusybiscuit.slimefun4.core.services.metrics;
|
||||
|
||||
import org.bstats.bukkit.Metrics.SimplePie;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class GuideLayoutChart extends SimplePie {
|
||||
|
||||
|
@ -3,7 +3,7 @@ package io.github.thebusybiscuit.slimefun4.core.services.metrics;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
/**
|
||||
* This Class represents a Metrics Service that sends data to https://bstats.org/
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class PlayerLanguageChart extends AdvancedPie {
|
||||
|
||||
@ -17,8 +17,8 @@ class PlayerLanguageChart extends AdvancedPie {
|
||||
Map<String, Integer> languages = new HashMap<>();
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
Language language = SlimefunPlugin.getLocal().getLanguage(p);
|
||||
boolean supported = SlimefunPlugin.getLocal().isLanguageLoaded(language.getId());
|
||||
Language language = SlimefunPlugin.getLocalization().getLanguage(p);
|
||||
boolean supported = SlimefunPlugin.getLocalization().isLanguageLoaded(language.getId());
|
||||
|
||||
String lang = supported ? language.getId() : "Unsupported Language";
|
||||
languages.merge(lang, 1, Integer::sum);
|
||||
|
@ -2,7 +2,7 @@ package io.github.thebusybiscuit.slimefun4.core.services.metrics;
|
||||
|
||||
import org.bstats.bukkit.Metrics.SimplePie;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class ResearchesEnabledChart extends SimplePie {
|
||||
|
||||
|
@ -2,7 +2,7 @@ package io.github.thebusybiscuit.slimefun4.core.services.metrics;
|
||||
|
||||
import org.bstats.bukkit.Metrics.SimplePie;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class ResourcePackChart extends SimplePie {
|
||||
|
||||
|
@ -3,14 +3,14 @@ package io.github.thebusybiscuit.slimefun4.core.services.metrics;
|
||||
import org.bstats.bukkit.Metrics.SimplePie;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class ServerLanguageChart extends SimplePie {
|
||||
|
||||
ServerLanguageChart() {
|
||||
super("language", () -> {
|
||||
Language language = SlimefunPlugin.getLocal().getDefaultLanguage();
|
||||
boolean supported = SlimefunPlugin.getLocal().isLanguageLoaded(language.getId());
|
||||
Language language = SlimefunPlugin.getLocalization().getDefaultLanguage();
|
||||
boolean supported = SlimefunPlugin.getLocalization().isLanguageLoaded(language.getId());
|
||||
return supported ? language.getId() : "Unsupported Language";
|
||||
});
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import java.util.Map;
|
||||
|
||||
import org.bstats.bukkit.Metrics.DrilldownPie;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
class SlimefunVersionChart extends DrilldownPie {
|
||||
|
||||
|
@ -7,9 +7,9 @@ import org.bukkit.entity.Item;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.minebuilders.clearlag.events.EntityRemoveEvent;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
|
||||
class ClearLagHook implements Listener {
|
||||
|
||||
|
@ -9,8 +9,8 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import io.github.thebusybiscuit.slimefun4.core.researching.Research;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
|
||||
class PlaceholderAPIHook extends PlaceholderExpansion {
|
||||
|
||||
@ -85,7 +85,7 @@ class PlaceholderAPIHook extends PlaceholderExpansion {
|
||||
}
|
||||
|
||||
if (params.equals("timings_lag")) {
|
||||
return SlimefunPlugin.getTicker().getTime() + "ms";
|
||||
return SlimefunPlugin.getTickerTask().getTime() + "ms";
|
||||
}
|
||||
|
||||
if (params.equals("language")) {
|
||||
@ -93,7 +93,7 @@ class PlaceholderAPIHook extends PlaceholderExpansion {
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
return SlimefunPlugin.getLocal().getLanguage((Player) p).getName((Player) p);
|
||||
return SlimefunPlugin.getLocalization().getLanguage((Player) p).getName((Player) p);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -11,7 +11,7 @@ import org.bukkit.plugin.Plugin;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
|
||||
import io.github.thebusybiscuit.slimefun4.core.categories.FlexCategory;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
/**
|
||||
|
@ -20,7 +20,6 @@ import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.HeadTexture;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.LoreBuilder;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.itemstack.ColoredFireworkStar;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,624 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.plugin.java.JavaPluginLoader;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.config.Config;
|
||||
import io.github.thebusybiscuit.cscorelib2.math.DoubleHandler;
|
||||
import io.github.thebusybiscuit.cscorelib2.protection.ProtectionManager;
|
||||
import io.github.thebusybiscuit.cscorelib2.reflection.ReflectionUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
|
||||
import io.github.thebusybiscuit.slimefun4.api.gps.GPSNetwork;
|
||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import io.github.thebusybiscuit.slimefun4.core.SlimefunRegistry;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.core.networks.NetworkManager;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.AutoSavingService;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.BackupService;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.BlockDataService;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.CustomItemDataService;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.CustomTextureService;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.LocalizationService;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.MinecraftRecipeService;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.PerWorldSettingsService;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.PermissionsService;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.UpdaterService;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.github.GitHubService;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.metrics.MetricsService;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.plugins.ThirdPartyPluginService;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.altar.AncientAltar;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.backpacks.Cooler;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.BasicCircuitBoard;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.reactors.Reactor;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.tools.GrapplingHook;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.weapons.SeismicAxe;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.weapons.VampireBlade;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.AncientAltarListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.BackpackListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.BlockListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.BlockPhysicsListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.CargoNodeListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.CoolerListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.DeathpointListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.DebugFishListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.DispenserListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.EnhancedFurnaceListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.ExplosionsListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.FireworksListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.GadgetsListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.GrapplingHookListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.IronGolemListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.ItemPickupListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.MobDropListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.MultiBlockListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.PlayerInteractEntityListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.PlayerProfileListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SeismicAxeListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunBootsListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunBowListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunGuideListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunItemConsumeListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunItemListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SoulboundListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.TalismanListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.VampireBladeListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.VanillaMachinesListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.WitherListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.WorldListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.resources.GEOResourcesSetup;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.setup.PostSetup;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.setup.ResearchSetup;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.setup.SlimefunItemSetup;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.tasks.ArmorTask;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.tasks.SlimefunStartupTask;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.tasks.TickerTask;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AGenerator;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.UniversalBlockMenu;
|
||||
|
||||
/**
|
||||
* This is the main class of Slimefun.
|
||||
* This is where all the magic starts, take a look around.
|
||||
* Feel like home.
|
||||
*
|
||||
* @author TheBusyBiscuit
|
||||
*/
|
||||
public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
|
||||
|
||||
public static SlimefunPlugin instance;
|
||||
|
||||
private MinecraftVersion minecraftVersion = MinecraftVersion.UNKNOWN;
|
||||
|
||||
private final SlimefunRegistry registry = new SlimefunRegistry();
|
||||
private final TickerTask ticker = new TickerTask();
|
||||
private final SlimefunCommand command = new SlimefunCommand(this);
|
||||
|
||||
// Services - Systems that fulfill certain tasks, treat them as a black box
|
||||
private final CustomItemDataService itemDataService = new CustomItemDataService(this, "slimefun_item");
|
||||
private final BlockDataService blockDataService = new BlockDataService(this, "slimefun_block");
|
||||
private final CustomTextureService textureService = new CustomTextureService(new Config(this, "item-models.yml"));
|
||||
private final GitHubService gitHubService = new GitHubService("TheBusyBiscuit/Slimefun4");
|
||||
private final UpdaterService updaterService = new UpdaterService(this, getDescription().getVersion(), getFile());
|
||||
private final MetricsService metricsService = new MetricsService(this);
|
||||
private final AutoSavingService autoSavingService = new AutoSavingService();
|
||||
private final BackupService backupService = new BackupService();
|
||||
private final PermissionsService permissionsService = new PermissionsService(this);
|
||||
private final PerWorldSettingsService worldSettingsService = new PerWorldSettingsService(this);
|
||||
private final ThirdPartyPluginService thirdPartySupportService = new ThirdPartyPluginService(this);
|
||||
private final MinecraftRecipeService recipeService = new MinecraftRecipeService(this);
|
||||
private LocalizationService local;
|
||||
|
||||
private GPSNetwork gpsNetwork;
|
||||
private NetworkManager networkManager;
|
||||
private ProtectionManager protections;
|
||||
|
||||
// Important config files for Slimefun
|
||||
private final Config config = new Config(this);
|
||||
private final Config items = new Config(this, "Items.yml");
|
||||
private final Config researches = new Config(this, "Researches.yml");
|
||||
|
||||
// Listeners that need to be accessed elsewhere
|
||||
private final AncientAltarListener ancientAltarListener = new AncientAltarListener();
|
||||
private final GrapplingHookListener grapplingHookListener = new GrapplingHookListener();
|
||||
private final BackpackListener backpackListener = new BackpackListener();
|
||||
private final SlimefunBowListener bowListener = new SlimefunBowListener();
|
||||
|
||||
public SlimefunPlugin() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SlimefunPlugin(JavaPluginLoader loader, PluginDescriptionFile description, File dataFolder, File file) {
|
||||
super(loader, description, dataFolder, file);
|
||||
minecraftVersion = MinecraftVersion.UNIT_TEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
if (minecraftVersion == MinecraftVersion.UNIT_TEST) {
|
||||
instance = this;
|
||||
local = new LocalizationService(this, "", null);
|
||||
gpsNetwork = new GPSNetwork();
|
||||
command.register();
|
||||
}
|
||||
else if (getServer().getPluginManager().isPluginEnabled("CS-CoreLib")) {
|
||||
long timestamp = System.nanoTime();
|
||||
|
||||
// We wanna ensure that the Server uses a compatible version of Minecraft
|
||||
if (isVersionUnsupported()) {
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
instance = this;
|
||||
|
||||
// Creating all necessary Folders
|
||||
getLogger().log(Level.INFO, "Loading various systems...");
|
||||
createDirectories();
|
||||
registry.load(config);
|
||||
|
||||
// Set up localization
|
||||
local = new LocalizationService(this, config.getString("options.chat-prefix"), config.getString("options.language"));
|
||||
|
||||
// Setting up Networks
|
||||
gpsNetwork = new GPSNetwork();
|
||||
|
||||
int networkSize = config.getInt("networks.max-size");
|
||||
|
||||
if (networkSize < 1) {
|
||||
getLogger().log(Level.WARNING, "Your 'networks.max-size' setting is misconfigured! It must be at least 1, it was set to: {0}", networkSize);
|
||||
networkSize = 1;
|
||||
}
|
||||
|
||||
networkManager = new NetworkManager(networkSize);
|
||||
|
||||
// Setting up bStats
|
||||
metricsService.start();
|
||||
|
||||
// Starting the Auto-Updater
|
||||
if (config.getBoolean("options.auto-update")) {
|
||||
getLogger().log(Level.INFO, "Starting Auto-Updater...");
|
||||
updaterService.start();
|
||||
}
|
||||
else {
|
||||
updaterService.disable();
|
||||
}
|
||||
|
||||
// Registering all GEO Resources
|
||||
getLogger().log(Level.INFO, "Loading GEO-Resources...");
|
||||
GEOResourcesSetup.setup();
|
||||
|
||||
getLogger().log(Level.INFO, "Loading items...");
|
||||
loadItems();
|
||||
|
||||
getLogger().log(Level.INFO, "Loading researches...");
|
||||
loadResearches();
|
||||
|
||||
registry.setResearchingEnabled(getResearchCfg().getBoolean("enable-researching"));
|
||||
PostSetup.setupWiki();
|
||||
|
||||
// All Slimefun Listeners
|
||||
new SlimefunBootsListener(this);
|
||||
new SlimefunItemListener(this);
|
||||
new SlimefunItemConsumeListener(this);
|
||||
new BlockPhysicsListener(this);
|
||||
new CargoNodeListener(this);
|
||||
new MultiBlockListener(this);
|
||||
new GadgetsListener(this);
|
||||
new DispenserListener(this);
|
||||
new BlockListener(this);
|
||||
new EnhancedFurnaceListener(this);
|
||||
new ItemPickupListener(this);
|
||||
new DeathpointListener(this);
|
||||
new ExplosionsListener(this);
|
||||
new DebugFishListener(this);
|
||||
new VanillaMachinesListener(this);
|
||||
new FireworksListener(this);
|
||||
new WitherListener(this);
|
||||
new IronGolemListener(this);
|
||||
new PlayerInteractEntityListener(this);
|
||||
|
||||
new MobDropListener(this, (BasicCircuitBoard) SlimefunItems.BASIC_CIRCUIT_BOARD.getItem());
|
||||
|
||||
// Item-specific Listeners
|
||||
new VampireBladeListener(this, (VampireBlade) SlimefunItems.BLADE_OF_VAMPIRES.getItem());
|
||||
new CoolerListener(this, (Cooler) SlimefunItems.COOLER.getItem());
|
||||
new SeismicAxeListener(this, (SeismicAxe) SlimefunItems.SEISMIC_AXE.getItem());
|
||||
grapplingHookListener.register(this, (GrapplingHook) SlimefunItems.GRAPPLING_HOOK.getItem());
|
||||
ancientAltarListener.register(this, (AncientAltar) SlimefunItems.ANCIENT_ALTAR.getItem());
|
||||
|
||||
bowListener.register(this);
|
||||
|
||||
// Toggleable Listeners for performance reasons
|
||||
if (config.getBoolean("items.talismans")) {
|
||||
new TalismanListener(this);
|
||||
}
|
||||
|
||||
if (config.getBoolean("items.soulbound")) {
|
||||
new SoulboundListener(this);
|
||||
}
|
||||
|
||||
if (config.getBoolean("items.backpacks")) {
|
||||
backpackListener.register(this);
|
||||
}
|
||||
|
||||
// Handle Slimefun Guide being given on Join
|
||||
new SlimefunGuideListener(this, config.getBoolean("guide.receive-on-first-join"));
|
||||
|
||||
// Load/Unload Worlds in Slimefun
|
||||
new WorldListener(this);
|
||||
|
||||
// Clear the Slimefun Guide History upon Player Leaving
|
||||
new PlayerProfileListener(this);
|
||||
|
||||
// Initiating various Stuff and all Items with a slightly delay (0ms after the Server finished loading)
|
||||
Slimefun.runSync(new SlimefunStartupTask(this, () -> {
|
||||
protections = new ProtectionManager(getServer());
|
||||
textureService.register(registry.getAllSlimefunItems(), true);
|
||||
permissionsService.register(registry.getAllSlimefunItems(), true);
|
||||
recipeService.refresh();
|
||||
}), 0);
|
||||
|
||||
// Setting up the command /sf and all subcommands
|
||||
command.register();
|
||||
|
||||
// Armor Update Task
|
||||
if (config.getBoolean("options.enable-armor-effects")) {
|
||||
getServer().getScheduler().runTaskTimerAsynchronously(this, new ArmorTask(), 0L, config.getInt("options.armor-update-interval") * 20L);
|
||||
}
|
||||
|
||||
autoSavingService.start(this, config.getInt("options.auto-save-delay-in-minutes"));
|
||||
ticker.start(this);
|
||||
thirdPartySupportService.start();
|
||||
gitHubService.start(this);
|
||||
|
||||
// Hooray!
|
||||
getLogger().log(Level.INFO, "Slimefun has finished loading in {0}", getStartupTime(timestamp));
|
||||
}
|
||||
else {
|
||||
getLogger().log(Level.INFO, "#################### - INFO - ####################");
|
||||
getLogger().log(Level.INFO, " ");
|
||||
getLogger().log(Level.INFO, "Slimefun could not be loaded (yet).");
|
||||
getLogger().log(Level.INFO, "It appears that you have not installed CS-CoreLib.");
|
||||
getLogger().log(Level.INFO, "Please download and install CS-CoreLib manually:");
|
||||
getLogger().log(Level.INFO, "https://thebusybiscuit.github.io/builds/TheBusyBiscuit/CS-CoreLib/master/");
|
||||
|
||||
getCommand("slimefun").setExecutor((sender, cmd, label, args) -> {
|
||||
sender.sendMessage("You have forgotten to install CS-CoreLib! Slimefun is disabled.");
|
||||
sender.sendMessage("https://thebusybiscuit.github.io/builds/TheBusyBiscuit/CS-CoreLib/master/");
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private String getStartupTime(long timestamp) {
|
||||
long ms = (System.nanoTime() - timestamp) / 1000000;
|
||||
|
||||
if (ms > 1000) {
|
||||
return DoubleHandler.fixDouble(ms / 1000.0) + "s";
|
||||
}
|
||||
else {
|
||||
return DoubleHandler.fixDouble(ms) + "ms";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method checks for the {@link MinecraftVersion} of the {@link Server}.
|
||||
* If the version is unsupported, a warning will be printed to the console.
|
||||
*
|
||||
* @return Whether the {@link MinecraftVersion} is unsupported
|
||||
*/
|
||||
private boolean isVersionUnsupported() {
|
||||
String currentVersion = ReflectionUtils.getVersion();
|
||||
|
||||
if (currentVersion.startsWith("v")) {
|
||||
for (MinecraftVersion version : MinecraftVersion.values()) {
|
||||
if (version.matches(currentVersion)) {
|
||||
minecraftVersion = version;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Looks like you are using an unsupported Minecraft Version
|
||||
getLogger().log(Level.SEVERE, "#############################################");
|
||||
getLogger().log(Level.SEVERE, "### Slimefun was not installed correctly!");
|
||||
getLogger().log(Level.SEVERE, "### You are using the wrong version of Minecraft!");
|
||||
getLogger().log(Level.SEVERE, "###");
|
||||
getLogger().log(Level.SEVERE, "### You are using Minecraft {0}", ReflectionUtils.getVersion());
|
||||
getLogger().log(Level.SEVERE, "### but Slimefun v{0} requires you to be using", getDescription().getVersion());
|
||||
getLogger().log(Level.SEVERE, "### Minecraft {0}", String.join(" / ", getSupportedVersions()));
|
||||
getLogger().log(Level.SEVERE, "#############################################");
|
||||
return true;
|
||||
}
|
||||
|
||||
getLogger().log(Level.WARNING, "We could not determine the version of Minecraft you were using ({0})", currentVersion);
|
||||
return false;
|
||||
}
|
||||
|
||||
private Collection<String> getSupportedVersions() {
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
for (MinecraftVersion version : MinecraftVersion.values()) {
|
||||
if (version != MinecraftVersion.UNKNOWN) {
|
||||
list.add(version.getName());
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
// Slimefun never loaded successfully, so we don't even bother doing stuff here
|
||||
if (instance == null || minecraftVersion == MinecraftVersion.UNIT_TEST) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Cancel all tasks from this plugin immediately
|
||||
Bukkit.getScheduler().cancelTasks(this);
|
||||
|
||||
// Finishes all started movements/removals of block data
|
||||
ticker.halt();
|
||||
ticker.run();
|
||||
|
||||
// Save all Player Profiles that are still in memory
|
||||
PlayerProfile.iterator().forEachRemaining(profile -> {
|
||||
if (profile.isDirty()) {
|
||||
profile.save();
|
||||
}
|
||||
});
|
||||
|
||||
// Save all registered Worlds
|
||||
for (Map.Entry<String, BlockStorage> entry : getRegistry().getWorlds().entrySet()) {
|
||||
try {
|
||||
entry.getValue().save(true);
|
||||
}
|
||||
catch (Exception x) {
|
||||
getLogger().log(Level.SEVERE, x, () -> "An Error occurred while saving Slimefun-Blocks in World '" + entry.getKey() + "' for Slimefun " + getVersion());
|
||||
}
|
||||
}
|
||||
|
||||
for (UniversalBlockMenu menu : registry.getUniversalInventories().values()) {
|
||||
menu.save();
|
||||
}
|
||||
|
||||
// Create a new backup zip
|
||||
backupService.run();
|
||||
|
||||
// Prevent Memory Leaks
|
||||
// These static Maps should be removed at some point...
|
||||
AContainer.processing = null;
|
||||
AContainer.progress = null;
|
||||
|
||||
AGenerator.processing = null;
|
||||
AGenerator.progress = null;
|
||||
|
||||
Reactor.processing = null;
|
||||
Reactor.progress = null;
|
||||
|
||||
instance = null;
|
||||
|
||||
// Close all inventories on the server to prevent item dupes
|
||||
// (Incase some idiot uses /reload)
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
p.closeInventory();
|
||||
}
|
||||
}
|
||||
|
||||
private void createDirectories() {
|
||||
String[] storageFolders = { "Players", "blocks", "stored-blocks", "stored-inventories", "stored-chunks", "universal-inventories", "waypoints", "block-backups" };
|
||||
String[] pluginFolders = { "scripts", "generators", "error-reports", "cache/github", "world-settings" };
|
||||
|
||||
for (String folder : storageFolders) {
|
||||
File file = new File("data-storage/Slimefun", folder);
|
||||
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
}
|
||||
|
||||
for (String folder : pluginFolders) {
|
||||
File file = new File("plugins/Slimefun", folder);
|
||||
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void loadItems() {
|
||||
try {
|
||||
SlimefunItemSetup.setup(this);
|
||||
}
|
||||
catch (Exception | LinkageError x) {
|
||||
getLogger().log(Level.SEVERE, x, () -> "An Error occurred while initializing SlimefunItems for Slimefun " + getVersion());
|
||||
}
|
||||
}
|
||||
|
||||
private void loadResearches() {
|
||||
try {
|
||||
ResearchSetup.setupResearches();
|
||||
}
|
||||
catch (Exception | LinkageError x) {
|
||||
getLogger().log(Level.SEVERE, x, () -> "An Error occurred while initializing Slimefun Researches for Slimefun " + getVersion());
|
||||
}
|
||||
}
|
||||
|
||||
public static Config getCfg() {
|
||||
return instance.config;
|
||||
}
|
||||
|
||||
public static Config getResearchCfg() {
|
||||
return instance.researches;
|
||||
}
|
||||
|
||||
public static Config getItemCfg() {
|
||||
return instance.items;
|
||||
}
|
||||
|
||||
public static GPSNetwork getGPSNetwork() {
|
||||
return instance.gpsNetwork;
|
||||
}
|
||||
|
||||
public static TickerTask getTickerTask() {
|
||||
return instance.ticker;
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns the version of Slimefun that is currently installed.
|
||||
*
|
||||
* @return The currently installed version of Slimefun
|
||||
*/
|
||||
public static String getVersion() {
|
||||
return instance.getDescription().getVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns the {@link LocalizationService} of Slimefun.
|
||||
*
|
||||
* @return The {@link LocalizationService} of Slimefun
|
||||
*/
|
||||
public static LocalizationService getLocalization() {
|
||||
return instance.local;
|
||||
}
|
||||
|
||||
public static ProtectionManager getProtectionManager() {
|
||||
return instance.protections;
|
||||
}
|
||||
|
||||
public static MinecraftRecipeService getMinecraftRecipeService() {
|
||||
return instance.recipeService;
|
||||
}
|
||||
|
||||
public static CustomItemDataService getItemDataService() {
|
||||
return instance.itemDataService;
|
||||
}
|
||||
|
||||
public static CustomTextureService getItemTextureService() {
|
||||
return instance.textureService;
|
||||
}
|
||||
|
||||
public static PermissionsService getPermissionsService() {
|
||||
return instance.permissionsService;
|
||||
}
|
||||
|
||||
public static BlockDataService getBlockDataService() {
|
||||
return instance.blockDataService;
|
||||
}
|
||||
|
||||
public static ThirdPartyPluginService getThirdPartySupportService() {
|
||||
return instance.thirdPartySupportService;
|
||||
}
|
||||
|
||||
public static PerWorldSettingsService getWorldSettingsService() {
|
||||
return instance.worldSettingsService;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the {@link UpdaterService} of Slimefun.
|
||||
* It is used to handle automatic updates.
|
||||
*
|
||||
* @return The {@link UpdaterService} for Slimefun
|
||||
*/
|
||||
public static UpdaterService getUpdater() {
|
||||
return instance.updaterService;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the {@link GitHubService} of Slimefun.
|
||||
* It is used to retrieve data from GitHub repositories.
|
||||
*
|
||||
* @return The {@link GitHubService} for Slimefun
|
||||
*/
|
||||
public static GitHubService getGitHubService() {
|
||||
return instance.gitHubService;
|
||||
}
|
||||
|
||||
public static SlimefunRegistry getRegistry() {
|
||||
return instance.registry;
|
||||
}
|
||||
|
||||
public static NetworkManager getNetworkManager() {
|
||||
return instance.networkManager;
|
||||
}
|
||||
|
||||
public static AncientAltarListener getAncientAltarListener() {
|
||||
return instance.ancientAltarListener;
|
||||
}
|
||||
|
||||
public static GrapplingHookListener getGrapplingHookListener() {
|
||||
return instance.grapplingHookListener;
|
||||
}
|
||||
|
||||
public static BackpackListener getBackpackListener() {
|
||||
return instance.backpackListener;
|
||||
}
|
||||
|
||||
public static SlimefunBowListener getBowListener() {
|
||||
return instance.bowListener;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a {@link Set} of every {@link Plugin} that lists Slimefun
|
||||
* as a required or optional dependency.
|
||||
* <p>
|
||||
* We will just assume this to be a list of our addons.
|
||||
*
|
||||
* @return A {@link Set} of every {@link Plugin} that is dependent on Slimefun
|
||||
*/
|
||||
public static Set<Plugin> getInstalledAddons() {
|
||||
return Arrays.stream(instance.getServer().getPluginManager().getPlugins()).filter(plugin -> plugin.getDescription().getDepend().contains(instance.getName()) || plugin.getDescription().getSoftDepend().contains(instance.getName())).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
/**
|
||||
* The {@link Command} that was added by Slimefun.
|
||||
*
|
||||
* @return Slimefun's command
|
||||
*/
|
||||
public static SlimefunCommand getCommand() {
|
||||
return instance.command;
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns the currently installed version of Minecraft.
|
||||
*
|
||||
* @return The current version of Minecraft
|
||||
*/
|
||||
public static MinecraftVersion getMinecraftVersion() {
|
||||
return instance.minecraftVersion;
|
||||
}
|
||||
|
||||
public static String getCSCoreLibVersion() {
|
||||
return CSCoreLib.getLib().getDescription().getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaPlugin getJavaPlugin() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBugTrackerURL() {
|
||||
return "https://github.com/TheBusyBiscuit/Slimefun4/issues";
|
||||
}
|
||||
|
||||
}
|
@ -26,9 +26,9 @@ import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideImplementation;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideLayout;
|
||||
import io.github.thebusybiscuit.slimefun4.core.researching.Research;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
@ -54,15 +54,15 @@ public class BookSlimefunGuide implements SlimefunGuideImplementation {
|
||||
|
||||
private void openBook(Player p, PlayerProfile profile, List<ChatComponent> lines, boolean backButton) {
|
||||
CustomBookInterface book = new CustomBookInterface(SlimefunPlugin.instance);
|
||||
book.setTitle(SlimefunPlugin.getLocal().getMessage(p, "guide.title.main"));
|
||||
book.setTitle(SlimefunPlugin.getLocalization().getMessage(p, "guide.title.main"));
|
||||
|
||||
for (int i = 0; i < lines.size(); i = i + 10) {
|
||||
ChatComponent page = new ChatComponent("");
|
||||
ChatComponent header = new ChatComponent(ChatColors.color("&b&l- " + SlimefunPlugin.getLocal().getMessage(p, "guide.title.main") + " -\n\n"));
|
||||
ChatComponent header = new ChatComponent(ChatColors.color("&b&l- " + SlimefunPlugin.getLocalization().getMessage(p, "guide.title.main") + " -\n\n"));
|
||||
header.setHoverEvent(new HoverEvent(ChestMenuUtils.getSearchButton(p)));
|
||||
|
||||
header.setClickEvent(new ClickEvent(guideSearch, player -> Slimefun.runSync(() -> {
|
||||
SlimefunPlugin.getLocal().sendMessage(player, "guide.search.message");
|
||||
SlimefunPlugin.getLocalization().sendMessage(player, "guide.search.message");
|
||||
ChatInput.waitForPlayer(SlimefunPlugin.instance, player, msg -> SlimefunGuide.openSearch(profile, msg, true, true));
|
||||
}, 1)));
|
||||
|
||||
@ -75,8 +75,8 @@ public class BookSlimefunGuide implements SlimefunGuideImplementation {
|
||||
page.append(new ChatComponent("\n"));
|
||||
|
||||
if (backButton) {
|
||||
ChatComponent button = new ChatComponent(ChatColor.DARK_BLUE + "\u21E6 " + SlimefunPlugin.getLocal().getMessage(p, "guide.back.title"));
|
||||
button.setHoverEvent(new HoverEvent(ChatColor.DARK_BLUE + "\u21E6 " + SlimefunPlugin.getLocal().getMessage(p, "guide.back.title"), "", ChatColor.GRAY + SlimefunPlugin.getLocal().getMessage(p, "guide.back.guide")));
|
||||
ChatComponent button = new ChatComponent(ChatColor.DARK_BLUE + "\u21E6 " + SlimefunPlugin.getLocalization().getMessage(p, "guide.back.title"));
|
||||
button.setHoverEvent(new HoverEvent(ChatColor.DARK_BLUE + "\u21E6 " + SlimefunPlugin.getLocalization().getMessage(p, "guide.back.title"), "", ChatColor.GRAY + SlimefunPlugin.getLocalization().getMessage(p, "guide.back.guide")));
|
||||
button.setClickEvent(new ClickEvent(new NamespacedKey(SlimefunPlugin.instance, "slimefun_guide"), pl -> openMainMenu(profile, 1)));
|
||||
page.append(button);
|
||||
}
|
||||
@ -114,10 +114,10 @@ public class BookSlimefunGuide implements SlimefunGuideImplementation {
|
||||
|
||||
if (category instanceof LockedCategory && !((LockedCategory) category).hasUnlocked(p, profile)) {
|
||||
List<String> lore = new LinkedList<>();
|
||||
lore.add(ChatColor.DARK_RED + SlimefunPlugin.getLocal().getMessage(p, "guide.locked") + " " + ChatColor.GRAY + "- " + ChatColor.RESET + category.getItem(p).getItemMeta().getDisplayName());
|
||||
lore.add(ChatColor.DARK_RED + SlimefunPlugin.getLocalization().getMessage(p, "guide.locked") + " " + ChatColor.GRAY + "- " + ChatColor.RESET + category.getItem(p).getItemMeta().getDisplayName());
|
||||
lore.add("");
|
||||
|
||||
for (String line : SlimefunPlugin.getLocal().getMessages(p, "guide.locked-category")) {
|
||||
for (String line : SlimefunPlugin.getLocalization().getMessages(p, "guide.locked-category")) {
|
||||
lore.add(ChatColor.RESET + line);
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ public class BookSlimefunGuide implements SlimefunGuideImplementation {
|
||||
}
|
||||
else {
|
||||
ChatComponent chatComponent = new ChatComponent(ChatUtils.crop(ChatColor.DARK_GREEN, ItemUtils.getItemName(category.getItem(p))) + "\n");
|
||||
chatComponent.setHoverEvent(new HoverEvent(ItemUtils.getItemName(category.getItem(p)), "", ChatColor.GRAY + "\u21E8 " + ChatColor.GREEN + SlimefunPlugin.getLocal().getMessage(p, "guide.tooltips.open-category")));
|
||||
chatComponent.setHoverEvent(new HoverEvent(ItemUtils.getItemName(category.getItem(p)), "", ChatColor.GRAY + "\u21E8 " + ChatColor.GREEN + SlimefunPlugin.getLocalization().getMessage(p, "guide.tooltips.open-category")));
|
||||
chatComponent.setClickEvent(new ClickEvent(category.getKey(), pl -> openCategory(profile, category, 1)));
|
||||
lines.add(chatComponent);
|
||||
}
|
||||
@ -195,7 +195,7 @@ public class BookSlimefunGuide implements SlimefunGuideImplementation {
|
||||
Research research = item.getResearch();
|
||||
|
||||
ChatComponent component = new ChatComponent(ChatUtils.crop(ChatColor.RED, item.getItemName()) + "\n");
|
||||
component.setHoverEvent(new HoverEvent(ChatColor.RESET + item.getItemName(), ChatColor.DARK_RED.toString() + ChatColor.BOLD + SlimefunPlugin.getLocal().getMessage(p, "guide.locked"), "", ChatColor.GREEN + "> Click to unlock", "", ChatColor.GRAY + "Cost: " + ChatColor.AQUA.toString() + research.getCost() + " Level(s)"));
|
||||
component.setHoverEvent(new HoverEvent(ChatColor.RESET + item.getItemName(), ChatColor.DARK_RED.toString() + ChatColor.BOLD + SlimefunPlugin.getLocalization().getMessage(p, "guide.locked"), "", ChatColor.GREEN + "> Click to unlock", "", ChatColor.GRAY + "Cost: " + ChatColor.AQUA.toString() + research.getCost() + " Level(s)"));
|
||||
component.setClickEvent(new ClickEvent(key, player -> Slimefun.runSync(() -> {
|
||||
if (!SlimefunPlugin.getRegistry().getCurrentlyResearchingPlayers().contains(p.getUniqueId())) {
|
||||
if (research.canUnlock(p)) {
|
||||
@ -207,7 +207,7 @@ public class BookSlimefunGuide implements SlimefunGuideImplementation {
|
||||
}
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "messages.not-enough-xp", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "messages.not-enough-xp", true);
|
||||
}
|
||||
}
|
||||
})));
|
||||
|
@ -36,11 +36,11 @@ import io.github.thebusybiscuit.slimefun4.core.guide.options.SlimefunGuideSettin
|
||||
import io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlock;
|
||||
import io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine;
|
||||
import io.github.thebusybiscuit.slimefun4.core.researching.Research;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.MenuClickHandler;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
@ -115,9 +115,10 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
|
||||
while (target < (categories.size() - 1) && index < CATEGORY_SIZE + 9) {
|
||||
target++;
|
||||
Category category = categories.get(target);
|
||||
|
||||
Category category = categories.get(target);
|
||||
displayCategory(menu, p, profile, category, index);
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
@ -126,14 +127,22 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
menu.addItem(46, ChestMenuUtils.getPreviousButton(p, page, pages));
|
||||
menu.addMenuClickHandler(46, (pl, slot, item, action) -> {
|
||||
int next = page - 1;
|
||||
if (next != page && next > 0) openMainMenu(profile, next);
|
||||
|
||||
if (next != page && next > 0) {
|
||||
openMainMenu(profile, next);
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
menu.addItem(52, ChestMenuUtils.getNextButton(p, page, pages));
|
||||
menu.addMenuClickHandler(52, (pl, slot, item, action) -> {
|
||||
int next = page + 1;
|
||||
if (next != page && next <= pages) openMainMenu(profile, next);
|
||||
|
||||
if (next != page && next <= pages) {
|
||||
openMainMenu(profile, next);
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
@ -152,7 +161,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
List<String> lore = new ArrayList<>();
|
||||
lore.add("");
|
||||
|
||||
for (String line : SlimefunPlugin.getLocal().getMessages(p, "guide.locked-category")) {
|
||||
for (String line : SlimefunPlugin.getLocalization().getMessages(p, "guide.locked-category")) {
|
||||
lore.add(ChatColor.WHITE + line);
|
||||
}
|
||||
|
||||
@ -162,7 +171,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
lore.add(parent.getItem(p).getItemMeta().getDisplayName());
|
||||
}
|
||||
|
||||
menu.addItem(index, new CustomItem(Material.BARRIER, "&4" + SlimefunPlugin.getLocal().getMessage(p, "guide.locked") + " &7- &f" + category.getItem(p).getItemMeta().getDisplayName(), lore.toArray(new String[0])));
|
||||
menu.addItem(index, new CustomItem(Material.BARRIER, "&4" + SlimefunPlugin.getLocalization().getMessage(p, "guide.locked") + " &7- &f" + category.getItem(p).getItemMeta().getDisplayName(), lore.toArray(new String[0])));
|
||||
menu.addMenuClickHandler(index, ChestMenuUtils.getEmptyClickHandler());
|
||||
}
|
||||
}
|
||||
@ -187,7 +196,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
ChestMenu menu = create(p);
|
||||
createHeader(p, profile, menu);
|
||||
|
||||
menu.addItem(1, new CustomItem(ChestMenuUtils.getBackButton(p, "", ChatColor.GRAY + SlimefunPlugin.getLocal().getMessage(p, "guide.back.guide"))));
|
||||
menu.addItem(1, new CustomItem(ChestMenuUtils.getBackButton(p, "", ChatColor.GRAY + SlimefunPlugin.getLocalization().getMessage(p, "guide.back.guide"))));
|
||||
menu.addMenuClickHandler(1, (pl, s, is, action) -> {
|
||||
openMainMenu(profile, 1);
|
||||
return false;
|
||||
@ -214,71 +223,75 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
|
||||
for (int i = 0; i < CATEGORY_SIZE; i++) {
|
||||
int target = categoryIndex + i;
|
||||
if (target >= category.getItems().size()) break;
|
||||
|
||||
if (target >= category.getItems().size()) {
|
||||
break;
|
||||
}
|
||||
|
||||
SlimefunItem sfitem = category.getItems().get(target);
|
||||
|
||||
if (Slimefun.isEnabled(p, sfitem, false)) {
|
||||
Research research = sfitem.getResearch();
|
||||
|
||||
if (isSurvivalMode() && !Slimefun.hasPermission(p, sfitem, false)) {
|
||||
List<String> message = SlimefunPlugin.getPermissionsService().getLore(sfitem);
|
||||
menu.addItem(index, new CustomItem(Material.BARRIER, sfitem.getItemName(), message.toArray(new String[0])));
|
||||
menu.addMenuClickHandler(index, ChestMenuUtils.getEmptyClickHandler());
|
||||
index++;
|
||||
}
|
||||
else if (isSurvivalMode() && research != null && !profile.hasUnlocked(research)) {
|
||||
menu.addItem(index, new CustomItem(Material.BARRIER, ChatColor.WHITE + ItemUtils.getItemName(sfitem.getItem()), "&4&l" + SlimefunPlugin.getLocal().getMessage(p, "guide.locked"), "", "&a> Click to unlock", "", "&7Cost: &b" + research.getCost() + " Level(s)"));
|
||||
menu.addMenuClickHandler(index, (pl, slot, item, action) -> {
|
||||
if (!SlimefunPlugin.getRegistry().getCurrentlyResearchingPlayers().contains(pl.getUniqueId())) {
|
||||
if (research.canUnlock(pl)) {
|
||||
if (profile.hasUnlocked(research)) {
|
||||
openCategory(profile, category, page);
|
||||
}
|
||||
else {
|
||||
unlockItem(pl, sfitem, player -> openCategory(profile, category, page));
|
||||
}
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(pl, "messages.not-enough-xp", true);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
index++;
|
||||
}
|
||||
else {
|
||||
menu.addItem(index, sfitem.getItem());
|
||||
menu.addMenuClickHandler(index, (pl, slot, item, action) -> {
|
||||
try {
|
||||
if (isSurvivalMode()) {
|
||||
displayItem(profile, sfitem, true);
|
||||
}
|
||||
else {
|
||||
if (sfitem instanceof MultiBlockMachine) {
|
||||
SlimefunPlugin.getLocal().sendMessage(pl, "guide.cheat.no-multiblocks");
|
||||
}
|
||||
else {
|
||||
pl.getInventory().addItem(sfitem.getItem().clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception | LinkageError x) {
|
||||
printErrorMessage(pl, x);
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
index++;
|
||||
}
|
||||
displaySlimefunItem(menu, category, p, profile, sfitem, page, index);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
menu.open(p);
|
||||
}
|
||||
|
||||
private void displaySlimefunItem(ChestMenu menu, Category category, Player p, PlayerProfile profile, SlimefunItem sfitem, int page, int index) {
|
||||
Research research = sfitem.getResearch();
|
||||
|
||||
if (isSurvivalMode() && !Slimefun.hasPermission(p, sfitem, false)) {
|
||||
List<String> message = SlimefunPlugin.getPermissionsService().getLore(sfitem);
|
||||
menu.addItem(index, new CustomItem(Material.BARRIER, sfitem.getItemName(), message.toArray(new String[0])));
|
||||
menu.addMenuClickHandler(index, ChestMenuUtils.getEmptyClickHandler());
|
||||
}
|
||||
else if (isSurvivalMode() && research != null && !profile.hasUnlocked(research)) {
|
||||
menu.addItem(index, new CustomItem(Material.BARRIER, ChatColor.WHITE + ItemUtils.getItemName(sfitem.getItem()), "&4&l" + SlimefunPlugin.getLocalization().getMessage(p, "guide.locked"), "", "&a> Click to unlock", "", "&7Cost: &b" + research.getCost() + " Level(s)"));
|
||||
menu.addMenuClickHandler(index, (pl, slot, item, action) -> {
|
||||
if (!SlimefunPlugin.getRegistry().getCurrentlyResearchingPlayers().contains(pl.getUniqueId())) {
|
||||
if (research.canUnlock(pl)) {
|
||||
if (profile.hasUnlocked(research)) {
|
||||
openCategory(profile, category, page);
|
||||
}
|
||||
else {
|
||||
unlockItem(pl, sfitem, player -> openCategory(profile, category, page));
|
||||
}
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocalization().sendMessage(pl, "messages.not-enough-xp", true);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
else {
|
||||
menu.addItem(index, sfitem.getItem());
|
||||
menu.addMenuClickHandler(index, (pl, slot, item, action) -> {
|
||||
try {
|
||||
if (isSurvivalMode()) {
|
||||
displayItem(profile, sfitem, true);
|
||||
}
|
||||
else {
|
||||
if (sfitem instanceof MultiBlockMachine) {
|
||||
SlimefunPlugin.getLocalization().sendMessage(pl, "guide.cheat.no-multiblocks");
|
||||
}
|
||||
else {
|
||||
pl.getInventory().addItem(sfitem.getItem().clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception | LinkageError x) {
|
||||
printErrorMessage(pl, x);
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openSearch(PlayerProfile profile, String input, boolean addToHistory) {
|
||||
Player p = profile.getPlayer();
|
||||
@ -287,7 +300,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
return;
|
||||
}
|
||||
|
||||
ChestMenu menu = new ChestMenu(SlimefunPlugin.getLocal().getMessage(p, "guide.search.inventory").replace("%item%", ChatUtils.crop(ChatColor.WHITE, input)));
|
||||
ChestMenu menu = new ChestMenu(SlimefunPlugin.getLocalization().getMessage(p, "guide.search.inventory").replace("%item%", ChatUtils.crop(ChatColor.WHITE, input)));
|
||||
String searchTerm = input.toLowerCase(Locale.ROOT);
|
||||
|
||||
if (addToHistory) {
|
||||
@ -367,7 +380,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
return;
|
||||
}
|
||||
|
||||
Recipe[] recipes = SlimefunPlugin.getMinecraftRecipes().getRecipesFor(item);
|
||||
Recipe[] recipes = SlimefunPlugin.getMinecraftRecipeService().getRecipesFor(item);
|
||||
|
||||
if (recipes.length == 0) {
|
||||
return;
|
||||
@ -389,7 +402,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
if (optional.isPresent()) {
|
||||
MinecraftRecipe<?> mcRecipe = optional.get();
|
||||
|
||||
RecipeChoice[] choices = SlimefunPlugin.getMinecraftRecipes().getRecipeShape(recipe);
|
||||
RecipeChoice[] choices = SlimefunPlugin.getMinecraftRecipeService().getRecipeShape(recipe);
|
||||
|
||||
if (choices.length == 1 && choices[0] instanceof MaterialChoice) {
|
||||
recipeItems[4] = new ItemStack(((MaterialChoice) choices[0]).getChoices().get(0));
|
||||
@ -464,7 +477,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
Optional<String> wiki = item.getWikipage();
|
||||
|
||||
if (wiki.isPresent()) {
|
||||
menu.addItem(8, new CustomItem(Material.KNOWLEDGE_BOOK, ChatColor.WHITE + SlimefunPlugin.getLocal().getMessage(p, "guide.tooltips.wiki"), "", ChatColor.GRAY + "\u21E8 " + ChatColor.GREEN + SlimefunPlugin.getLocal().getMessage(p, "guide.tooltips.open-category")));
|
||||
menu.addItem(8, new CustomItem(Material.KNOWLEDGE_BOOK, ChatColor.WHITE + SlimefunPlugin.getLocalization().getMessage(p, "guide.tooltips.wiki"), "", ChatColor.GRAY + "\u21E8 " + ChatColor.GREEN + SlimefunPlugin.getLocalization().getMessage(p, "guide.tooltips.open-category")));
|
||||
menu.addMenuClickHandler(8, (pl, slot, itemstack, action) -> {
|
||||
pl.closeInventory();
|
||||
ChatUtils.sendURL(pl, wiki.get());
|
||||
@ -547,7 +560,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
menu.addMenuClickHandler(7, (pl, slot, item, action) -> {
|
||||
pl.closeInventory();
|
||||
|
||||
SlimefunPlugin.getLocal().sendMessage(pl, "guide.search.message");
|
||||
SlimefunPlugin.getLocalization().sendMessage(pl, "guide.search.message");
|
||||
ChatInput.waitForPlayer(SlimefunPlugin.instance, pl, msg -> SlimefunGuide.openSearch(profile, msg, isSurvivalMode(), isSurvivalMode()));
|
||||
|
||||
return false;
|
||||
@ -576,7 +589,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
|
||||
}
|
||||
else {
|
||||
menu.addItem(slot, new CustomItem(ChestMenuUtils.getBackButton(p, "", ChatColor.GRAY + SlimefunPlugin.getLocal().getMessage(p, "guide.back.guide"))));
|
||||
menu.addItem(slot, new CustomItem(ChestMenuUtils.getBackButton(p, "", ChatColor.GRAY + SlimefunPlugin.getLocalization().getMessage(p, "guide.back.guide"))));
|
||||
menu.addMenuClickHandler(slot, (pl, s, is, action) -> {
|
||||
openMainMenu(profile, 1);
|
||||
return false;
|
||||
@ -593,7 +606,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
}
|
||||
|
||||
String lore = Slimefun.hasPermission(p, slimefunItem, false) ? "&fNeeds to be unlocked elsewhere" : "&fNo Permission";
|
||||
return Slimefun.hasUnlocked(p, slimefunItem, false) ? item : new CustomItem(Material.BARRIER, ItemUtils.getItemName(item), "&4&l" + SlimefunPlugin.getLocal().getMessage(p, "guide.locked"), "", lore);
|
||||
return Slimefun.hasUnlocked(p, slimefunItem, false) ? item : new CustomItem(Material.BARRIER, ItemUtils.getItemName(item), "&4&l" + SlimefunPlugin.getLocalization().getMessage(p, "guide.locked"), "", lore);
|
||||
}
|
||||
else {
|
||||
return item;
|
||||
@ -681,7 +694,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
}
|
||||
|
||||
private ChestMenu create(Player p) {
|
||||
ChestMenu menu = new ChestMenu(SlimefunPlugin.getLocal().getMessage(p, "guide.title.main"));
|
||||
ChestMenu menu = new ChestMenu(SlimefunPlugin.getLocalization().getMessage(p, "guide.title.main"));
|
||||
|
||||
menu.setEmptySlotsClickable(false);
|
||||
menu.addMenuOpeningHandler(pl -> pl.playSound(pl.getLocation(), sound, 1, 1));
|
||||
|
@ -13,7 +13,7 @@ import org.bukkit.inventory.Recipe;
|
||||
import org.bukkit.inventory.RecipeChoice.MaterialChoice;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.collections.LoopIterator;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
/**
|
||||
* A {@link RecipeChoiceTask} is an asynchronously repeating task that cycles
|
||||
|
@ -3,8 +3,8 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.altar;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.AncientAltarListener;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
|
@ -7,7 +7,7 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
@ -11,7 +11,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
|
@ -11,7 +11,7 @@ import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
@ -11,7 +11,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import io.github.thebusybiscuit.cscorelib2.collections.RandomizedSet;
|
||||
import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
@ -13,7 +13,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections;
|
||||
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
|
||||
import io.github.thebusybiscuit.slimefun4.api.events.AndroidMineEvent;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
|
@ -31,6 +31,7 @@ import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.cscorelib2.skull.SkullBlock;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
|
||||
@ -39,7 +40,6 @@ import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunBlockHandler;
|
||||
@ -82,7 +82,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
|
||||
boolean open = BlockStorage.getLocationInfo(b.getLocation(), "owner").equals(p.getUniqueId().toString()) || p.hasPermission("slimefun.android.bypass");
|
||||
|
||||
if (!open) {
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "inventory.no-access", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "inventory.no-access", true);
|
||||
}
|
||||
|
||||
return open;
|
||||
@ -92,7 +92,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
|
||||
public void newInstance(BlockMenu menu, Block b) {
|
||||
menu.replaceExistingItem(15, new CustomItem(SlimefunUtils.getCustomHead("e01c7b5726178974b3b3a01b42a590e54366026fd43808f2a787648843a7f5a"), "&aStart/Continue"));
|
||||
menu.addMenuClickHandler(15, (p, slot, item, action) -> {
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "android.started", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "android.started", true);
|
||||
BlockStorage.addBlockInfo(b, "paused", "false");
|
||||
p.closeInventory();
|
||||
return false;
|
||||
@ -101,14 +101,14 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
|
||||
menu.replaceExistingItem(17, new CustomItem(SlimefunUtils.getCustomHead("16139fd1c5654e56e9e4e2c8be7eb2bd5b499d633616663feee99b74352ad64"), "&4Pause"));
|
||||
menu.addMenuClickHandler(17, (p, slot, item, action) -> {
|
||||
BlockStorage.addBlockInfo(b, "paused", "true");
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "android.stopped", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "android.stopped", true);
|
||||
return false;
|
||||
});
|
||||
|
||||
menu.replaceExistingItem(16, new CustomItem(SlimefunUtils.getCustomHead("d78f2b7e5e75639ea7fb796c35d364c4df28b4243e66b76277aadcd6261337"), "&bMemory Core", "", "&8\u21E8 &7Click to open the Script Editor"));
|
||||
menu.addMenuClickHandler(16, (p, slot, item, action) -> {
|
||||
BlockStorage.addBlockInfo(b, "paused", "true");
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "android.stopped", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "android.stopped", true);
|
||||
openScriptEditor(p, b);
|
||||
return false;
|
||||
});
|
||||
@ -211,9 +211,9 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
|
||||
}
|
||||
|
||||
public void openScript(Player p, Block b, String sourceCode) {
|
||||
ChestMenu menu = new ChestMenu(ChatColor.DARK_AQUA + SlimefunPlugin.getLocal().getMessage(p, "android.scripts.editor"));
|
||||
ChestMenu menu = new ChestMenu(ChatColor.DARK_AQUA + SlimefunPlugin.getLocalization().getMessage(p, "android.scripts.editor"));
|
||||
|
||||
menu.addItem(0, new CustomItem(Instruction.START.getItem(), SlimefunPlugin.getLocal().getMessage(p, "android.scripts.instructions.START"), "", "&7\u21E8 &eLeft Click &7to return to the Android's interface"));
|
||||
menu.addItem(0, new CustomItem(Instruction.START.getItem(), SlimefunPlugin.getLocalization().getMessage(p, "android.scripts.instructions.START"), "", "&7\u21E8 &eLeft Click &7to return to the Android's interface"));
|
||||
menu.addMenuClickHandler(0, (pl, slot, item, action) -> {
|
||||
BlockStorage.getInventory(b).open(pl);
|
||||
return false;
|
||||
@ -236,7 +236,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
|
||||
}
|
||||
|
||||
int slot = i + (hasFreeSlot ? 1 : 0);
|
||||
menu.addItem(slot, new CustomItem(Instruction.REPEAT.getItem(), SlimefunPlugin.getLocal().getMessage(p, "android.scripts.instructions.REPEAT"), "", "&7\u21E8 &eLeft Click &7to return to the Android's interface"));
|
||||
menu.addItem(slot, new CustomItem(Instruction.REPEAT.getItem(), SlimefunPlugin.getLocalization().getMessage(p, "android.scripts.instructions.REPEAT"), "", "&7\u21E8 &eLeft Click &7to return to the Android's interface"));
|
||||
menu.addMenuClickHandler(slot, (pl, s, item, action) -> {
|
||||
BlockStorage.getInventory(b).open(pl);
|
||||
return false;
|
||||
@ -244,7 +244,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
|
||||
}
|
||||
else {
|
||||
ItemStack stack = Instruction.valueOf(script[i]).getItem();
|
||||
menu.addItem(i, new CustomItem(stack, SlimefunPlugin.getLocal().getMessage(p, "android.scripts.instructions." + Instruction.valueOf(script[i]).name()), "", "&7\u21E8 &eLeft Click &7to edit", "&7\u21E8 &eRight Click &7to delete", "&7\u21E8 &eShift + Right Click &7to duplicate"));
|
||||
menu.addItem(i, new CustomItem(stack, SlimefunPlugin.getLocalization().getMessage(p, "android.scripts.instructions." + Instruction.valueOf(script[i]).name()), "", "&7\u21E8 &eLeft Click &7to edit", "&7\u21E8 &eRight Click &7to delete", "&7\u21E8 &eShift + Right Click &7to duplicate"));
|
||||
menu.addMenuClickHandler(i, (pl, slot, item, action) -> {
|
||||
if (action.isRightClicked() && action.isShiftClicked()) {
|
||||
if (script.length == 54) {
|
||||
@ -406,14 +406,14 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
|
||||
menu.addItem(index, item, (player, slot, stack, action) -> {
|
||||
if (action.isShiftClicked()) {
|
||||
if (script.isAuthor(player)) {
|
||||
SlimefunPlugin.getLocal().sendMessage(player, "android.scripts.rating.own", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(player, "android.scripts.rating.own", true);
|
||||
}
|
||||
else if (script.canRate(player)) {
|
||||
script.rate(player, !action.isRightClicked());
|
||||
openScriptDownloader(player, b, page);
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(player, "android.scripts.rating.already", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(player, "android.scripts.rating.already", true);
|
||||
}
|
||||
}
|
||||
else if (!action.isRightClicked()) {
|
||||
@ -447,24 +447,24 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
|
||||
}
|
||||
|
||||
if (script.getSourceCode().equals(code)) {
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "android.scripts.already-uploaded", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "android.scripts.already-uploaded", true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
p.closeInventory();
|
||||
SlimefunPlugin.getLocal().sendMessages(p, "android.scripts.enter-name");
|
||||
SlimefunPlugin.getLocalization().sendMessages(p, "android.scripts.enter-name");
|
||||
int id = nextId;
|
||||
|
||||
ChatInput.waitForPlayer(SlimefunPlugin.instance, p, msg -> {
|
||||
Script.upload(p, getAndroidType(), id, msg, code);
|
||||
SlimefunPlugin.getLocal().sendMessages(p, "android.scripts.uploaded");
|
||||
SlimefunPlugin.getLocalization().sendMessages(p, "android.scripts.uploaded");
|
||||
openScriptDownloader(p, b, page);
|
||||
});
|
||||
}
|
||||
|
||||
public void openScriptEditor(Player p, Block b) {
|
||||
ChestMenu menu = new ChestMenu(ChatColor.DARK_AQUA + SlimefunPlugin.getLocal().getMessage(p, "android.scripts.editor"));
|
||||
ChestMenu menu = new ChestMenu(ChatColor.DARK_AQUA + SlimefunPlugin.getLocalization().getMessage(p, "android.scripts.editor"));
|
||||
|
||||
menu.addItem(1, new CustomItem(SlimefunUtils.getCustomHead("d9bf6db4aeda9d8822b9f736538e8c18b9a4844f84eb45504adfbfee87eb"), "&2> Edit Script", "", "&aEdits your current Script"));
|
||||
menu.addMenuClickHandler(1, (pl, slot, item, action) -> {
|
||||
@ -515,7 +515,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
|
||||
}
|
||||
|
||||
protected void editInstruction(Player p, Block b, String[] script, int index) {
|
||||
ChestMenu menu = new ChestMenu(ChatColor.DARK_AQUA + SlimefunPlugin.getLocal().getMessage(p, "android.scripts.editor"));
|
||||
ChestMenu menu = new ChestMenu(ChatColor.DARK_AQUA + SlimefunPlugin.getLocalization().getMessage(p, "android.scripts.editor"));
|
||||
ChestMenuUtils.drawBackground(menu, 0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
|
||||
menu.addItem(9, new CustomItem(SlimefunUtils.getCustomHead("16139fd1c5654e56e9e4e2c8be7eb2bd5b499d633616663feee99b74352ad64"), "&rDo nothing"), (pl, slot, item, action) -> {
|
||||
@ -527,7 +527,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
|
||||
|
||||
int i = 10;
|
||||
for (Instruction instruction : getValidScriptInstructions()) {
|
||||
menu.addItem(i, new CustomItem(instruction.getItem(), SlimefunPlugin.getLocal().getMessage(p, "android.scripts.instructions." + instruction.name())), (pl, slot, item, action) -> {
|
||||
menu.addItem(i, new CustomItem(instruction.getItem(), SlimefunPlugin.getLocalization().getMessage(p, "android.scripts.instructions." + instruction.name())), (pl, slot, item, action) -> {
|
||||
String code = addInstruction(script, index, instruction);
|
||||
setScript(b.getLocation(), code);
|
||||
openScript(p, b, code);
|
||||
|
@ -15,7 +15,7 @@ import io.github.thebusybiscuit.cscorelib2.blocks.Vein;
|
||||
import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections;
|
||||
import io.github.thebusybiscuit.cscorelib2.materials.MaterialConverter;
|
||||
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
|
@ -5,8 +5,8 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerBackpack;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.BackpackListener;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SimpleSlimefunItem;
|
||||
|
@ -19,7 +19,7 @@ import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections;
|
||||
import io.github.thebusybiscuit.slimefun4.api.items.ItemSetting;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.NotPlaceable;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SimpleSlimefunItem;
|
||||
|
@ -20,8 +20,8 @@ import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections;
|
||||
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
|
||||
import io.github.thebusybiscuit.cscorelib2.scheduling.TaskQueue;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SimpleSlimefunItem;
|
||||
@ -101,7 +101,7 @@ public class Composter extends SimpleSlimefunItem<BlockUseHandler> implements Re
|
||||
tasks.execute(SlimefunPlugin.instance);
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "machines.wrong-item", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "machines.wrong-item", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,8 +17,8 @@ import org.bukkit.inventory.ItemStack;
|
||||
import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections;
|
||||
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SimpleSlimefunItem;
|
||||
@ -93,7 +93,7 @@ public class Crucible extends SimpleSlimefunItem<BlockUseHandler> implements Rec
|
||||
generateLiquid(block, water);
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "machines.wrong-item", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "machines.wrong-item", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,10 +11,10 @@ import org.bukkit.inventory.ItemStack;
|
||||
import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.cscorelib2.math.DoubleHandler;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.holograms.SimpleHologram;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunBlockHandler;
|
||||
@ -64,12 +64,12 @@ public class HologramProjector extends SimpleSlimefunItem<BlockUseHandler> {
|
||||
}
|
||||
|
||||
private static void openEditor(Player p, Block projector) {
|
||||
ChestMenu menu = new ChestMenu(SlimefunPlugin.getLocal().getMessage(p, "machines.HOLOGRAM_PROJECTOR.inventory-title"));
|
||||
ChestMenu menu = new ChestMenu(SlimefunPlugin.getLocalization().getMessage(p, "machines.HOLOGRAM_PROJECTOR.inventory-title"));
|
||||
|
||||
menu.addItem(0, new CustomItem(Material.NAME_TAG, "&7Text &e(Click to edit)", "", "&r" + ChatColors.color(BlockStorage.getLocationInfo(projector.getLocation(), "text"))));
|
||||
menu.addMenuClickHandler(0, (pl, slot, item, action) -> {
|
||||
pl.closeInventory();
|
||||
SlimefunPlugin.getLocal().sendMessage(pl, "machines.HOLOGRAM_PROJECTOR.enter-text", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(pl, "machines.HOLOGRAM_PROJECTOR.enter-text", true);
|
||||
|
||||
ChatUtils.awaitInput(pl, message -> {
|
||||
ArmorStand hologram = getArmorStand(projector, true);
|
||||
|
@ -5,8 +5,8 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
|
@ -9,9 +9,9 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunBlockHandler;
|
||||
|
@ -9,9 +9,9 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunBlockHandler;
|
||||
|
@ -7,9 +7,9 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunBlockHandler;
|
||||
|
@ -9,10 +9,10 @@ import org.bukkit.inventory.ItemStack;
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.reactors.Reactor;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
|
@ -11,7 +11,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.Rechargeable;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
@ -64,7 +64,7 @@ public class MultiTool extends SlimefunItem implements Rechargeable {
|
||||
|
||||
SlimefunItem selectedItem = modes.get(index).getItem();
|
||||
String itemName = selectedItem != null ? selectedItem.getItemName() : "Unknown";
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "messages.mode-change", true, msg -> msg.replace("%device%", "Multi Tool").replace("%mode%", ChatColor.stripColor(itemName)));
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "messages.mode-change", true, msg -> msg.replace("%device%", "Multi Tool").replace("%mode%", ChatColor.stripColor(itemName)));
|
||||
selectedMode.put(p.getUniqueId(), index);
|
||||
}
|
||||
};
|
||||
|
@ -7,7 +7,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.math.DoubleHandler;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SimpleSlimefunItem;
|
||||
@ -37,7 +37,7 @@ public class Multimeter extends SimpleSlimefunItem<ItemUseHandler> {
|
||||
|
||||
Player p = e.getPlayer();
|
||||
p.sendMessage("");
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "messages.multimeter", false, str -> str.replace("%stored%", stored).replace("%capacity%", capacity));
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "messages.multimeter", false, str -> str.replace("%stored%", stored).replace("%capacity%", capacity));
|
||||
p.sendMessage("");
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import org.bukkit.Tag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AGenerator;
|
||||
|
@ -119,7 +119,6 @@ public abstract class AutoBrewer extends AContainer {
|
||||
|
||||
if (isPotion(input1.getType()) || isPotion(input2.getType())) {
|
||||
boolean slot = isPotion(input1.getType());
|
||||
ItemStack potionItem = slot ? input1 : input2;
|
||||
ItemStack ingredient = slot ? input2 : input1;
|
||||
|
||||
// Reject any named items
|
||||
@ -127,8 +126,8 @@ public abstract class AutoBrewer extends AContainer {
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemStack potionItem = slot ? input1 : input2;
|
||||
PotionMeta potion = (PotionMeta) potionItem.getItemMeta();
|
||||
|
||||
ItemStack output = brew(ingredient.getType(), potionItem.getType(), potion);
|
||||
|
||||
if (output == null) {
|
||||
@ -145,7 +144,7 @@ public abstract class AutoBrewer extends AContainer {
|
||||
|
||||
private ItemStack brew(Material input, Material potionType, PotionMeta potion) {
|
||||
PotionData data = potion.getBasePotionData();
|
||||
|
||||
|
||||
if (data.getType() == PotionType.WATER) {
|
||||
if (input == Material.FERMENTED_SPIDER_EYE) {
|
||||
potion.setBasePotionData(new PotionData(PotionType.WEAKNESS, false, false));
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user