1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 11:45:51 +00:00

Merge pull request #12 from TheBusyBiscuit/master

update
This commit is contained in:
dniym 2020-07-31 16:09:17 -04:00 committed by GitHub
commit 2d12c5025b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
43 changed files with 380 additions and 275 deletions

View File

@ -1,7 +1,7 @@
name: Close invalid Issue
on:
issues:
on:
issues:
types: [opened]
jobs:
@ -29,6 +29,6 @@ jobs:
body: |-
Your issue seems to be missing our template.
[Click here to create a bug report](https://github.com/TheBusyBiscuit/Slimefun4/issues/new/choose)
Please remember that this Bug Tracker is exclusively reserved for Bug reports, any other form
of discussion, like suggestions or questions should be posted on our discord server (You can find a link [on our main page](https://github.com/TheBusyBiscuit/Slimefun4#discord)).

View File

@ -1,6 +1,7 @@
name: Respond to closed Issue
on:
issues:
on:
issues:
types: [closed]
jobs:
@ -28,20 +29,19 @@ jobs:
token: ${{ secrets.ACCESS_TOKEN }}
issue_number: ${{ github.event.issue.number }}
body: |-
Your issue was closed, it may fall under one or more of the following categories.
Your issue has been closed by an admin, it may fall under one or more of the following categories.
**Please wait for an admin to tick off the points that apply.**
Please respond below, if you have any questions.
Do **not** open a new Issue unless explicitly told otherwise, comment below or edit your post instead.
<hr>
* [ ] You did not follow our template. Please follow the Issue template to help us identify your issue more effectively.
* [ ] You did not provide any information about your versions (We absolutely need the exact version numbers that are installed on your Server, \"latest\" is not helpful)
* [ ] You did not provide a proper description to the problem. Try to write at least 4-6 sentences on how to reproduce this.
* [ ] You did not provide a proper description to the problem. Try to write at least 4-6 sentences and/or provide screenshots or videos on how to reproduce this.
* [ ] We were unable to reproduce issue, if you think your issue still persists then please comment down below and give a better description on how to reproduce it.
* [ ] Your issue was posted in a foreign language, we only accept english issues on here.
* [ ] Your issue is not a bug, it is either intended or something we cannot change.
* [ ] Your issue is not a bug, it is intended to work this way.
* [ ] Your issue is not really a bug, it is a limitation or simply something we have no control over.
* [ ] Your issue is not a bug, please only use this issue tracker to report bugs. Any other kind of communication should happen on discord.
* [ ] Your issue was already reported, it is a duplicate. Check the other issues first before posting!
* [ ] Your issue has already been reported before, it is a duplicate. Check the other issues first before posting!
* [ ] You posted an error without using pastebin. Please always post errors via pastebin otherwise they become nearly unreadable.
* [ ] You seem to be reporting multiple bugs at once. Please make a seperate issue for each bug you encountered, so we can properly handle them individually.
* [ ] Your issue has already been fixed in a later version of Slimefun or CS-CoreLib, you should update.
@ -50,5 +50,8 @@ jobs:
* [ ] You are using an unsupported version of Minecraft. We only provide support for the Minecraft versions Slimefun was developed for, older versions are not supported anymore.
* [ ] You are using a \"stable\" version of Slimefun (prefixed with \"RC - \"), your issue may have been fixed in a development build, so we only accept bug reports from those.
* [ ] You are on the wrong issue tracker. We would like to remind you that this Issue Tracker is **only for Slimefun**. To report bugs on any addons, head to the corresponding issue tracker of that addon.
<hr>
Please respond below, if you have any further questions.
Do **not** open a new Issue unless explicitly told otherwise, comment below or edit your post instead.<br>
Make sure to check out our article on [How to report bugs](https://github.com/TheBusyBiscuit/Slimefun4/wiki/How-to-report-bugs) for even more information.

View File

@ -1,7 +1,7 @@
name: Mark Issue as duplicate
on:
issue_comment:
on:
issue_comment:
types: [created]
jobs:

View File

@ -1,18 +1,19 @@
name: Translation Notifier
on:
on:
push:
branches:
- master
paths:
- 'src/main/resources/languages/**_en.yml'
jobs:
notify:
name: Translation-Notifier
runs-on: ubuntu-latest
if: github.repository == 'TheBusyBiscuit/Slimefun4'
steps:
- name: Discord Notification
uses: Ilshidur/action-discord@master

View File

@ -1,19 +1,19 @@
name: Changelog Populator
on:
on:
push:
branches:
- master
paths:
- 'CHANGELOG.md'
jobs:
populate:
name: Changelog Generator
runs-on: ubuntu-latest
if: github.repository == 'TheBusyBiscuit/Slimefun4'
steps:
- name: TOC Generator
uses: technote-space/toc-generator@v2.4.0

24
.github/workflows/yaml-linter.yml vendored Normal file
View File

@ -0,0 +1,24 @@
name: YAML Linter
on:
push:
paths:
- '**.yml'
pull_request:
branches:
- master
paths:
- '**.yml'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v1
- name: YAML Linter
uses: ibiqlik/action-yamllint@v1.0.0
with:
config_file: '.github/yaml-lint.yml'

17
.github/yaml-lint.yml vendored Normal file
View File

@ -0,0 +1,17 @@
extends: default
locale: en_US.UTF-8
yaml-files:
- '*.yml'
rules:
line-length:
max: 160
level: warning
## We don't need indentation warnings
indentation: disable
trailing-spaces:
ignore: |
/src/main/resources/languages/*.yml

View File

@ -2,7 +2,7 @@
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of contents**
- [Release Candidate 15 (TBD)](#release-candidate-15-tbd)
- [Release Candidate 15 (01 Aug 2020)](#release-candidate-15-01-aug-2020)
- [Release Candidate 14 (12 Jul 2020)](#release-candidate-14-12-jul-2020)
- [Release Candidate 13 (16 Jun 2020)](#release-candidate-13-16-jun-2020)
- [Release Candidate 12 (27 May 2020)](#release-candidate-12-27-may-2020)
@ -20,7 +20,7 @@
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
## Release Candidate 15 (TBD)
## Release Candidate 15 (01 Aug 2020)
#### Additions
* Added "Bone Block -> Bone meal" recipe to the Grind Stone
@ -33,6 +33,7 @@
* Added Bee protection to Hazmat Suit
* Added Enchantment Rune
* Added Tape Measure
* Added a permission node for /sf debug_fish
#### Changes
* Refactored and reworked the Generator API
@ -45,6 +46,11 @@
* Optimized Cargo networks for Paper
* Optimized Multiblocks for Paper
* Optimized Enhanced Furnaces for Paper
* General performance improvements for Talismans
* General performance improvements for GPS Emergency Transmitters
* General performance improvements for Infused Magnets
* Ancient Altars now support for protection plugins
* Ancient Pedestals now support for protection plugins
#### Fixes
* Fixed Slimefun Armor sometimes not applying its effects
@ -57,6 +63,14 @@
* Fixed Metrics not updating automatically
* Fixed #2143
* Fixed #2145
* Fixed #2151
* Fixed old Talismans not working
* Fixed Talismans sometimes not getting consumed properly
* Fixed old Infused Magnets not working
* Fixed old GPS Emergency Transmitters not working
* Fixed #2156
* Fixed #2165
* Fixed #2162
## Release Candidate 14 (12 Jul 2020)

View File

@ -4,6 +4,7 @@ import java.util.Map;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.defaults.HelpCommand;
import org.bukkit.entity.Player;
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
@ -23,14 +24,35 @@ public abstract class SubCommand {
protected final SlimefunPlugin plugin;
protected final SlimefunCommand cmd;
protected SubCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
private final String name;
private final boolean hidden;
protected SubCommand(SlimefunPlugin plugin, SlimefunCommand cmd, String name, boolean hidden) {
this.plugin = plugin;
this.cmd = cmd;
this.name = name;
this.hidden = hidden;
}
public abstract String getName();
/**
* This returns the name of this {@link SubCommand}, the name is equivalent to the
* first argument given to the actual command.
*
* @return The name of this {@link SubCommand}
*/
public final String getName() {
return name;
}
public abstract boolean isHidden();
/**
* This method returns whether this {@link SubCommand} is hidden from the {@link HelpCommand}.
*
* @return Whether to hide this {@link SubCommand}
*/
public final boolean isHidden() {
return hidden;
}
protected void recordUsage(Map<SubCommand, Integer> commandUsage) {
commandUsage.merge(this, 1, Integer::sum);

View File

@ -17,12 +17,7 @@ import me.mrCookieSlime.Slimefun.api.Slimefun;
class BackpackCommand extends SubCommand {
BackpackCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
super(plugin, cmd);
}
@Override
public String getName() {
return "backpack";
super(plugin, cmd, "backpack", false);
}
@Override
@ -30,11 +25,6 @@ class BackpackCommand extends SubCommand {
return "commands.backpack.description";
}
@Override
public boolean isHidden() {
return false;
}
@Override
public void onExecute(CommandSender sender, String[] args) {
if (!(sender instanceof Player) || !sender.hasPermission("slimefun.command.backpack")) {

View File

@ -11,17 +11,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
class CheatCommand extends SubCommand {
CheatCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
super(plugin, cmd);
}
@Override
public String getName() {
return "cheat";
}
@Override
public boolean isHidden() {
return false;
super(plugin, cmd, "cheat", false);
}
@Override

View File

@ -11,23 +11,13 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
class DebugFishCommand extends SubCommand {
DebugFishCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
super(plugin, cmd);
}
@Override
public String getName() {
return "debug_fish";
}
@Override
public boolean isHidden() {
return true;
super(plugin, cmd, "debug_fish", true);
}
@Override
public void onExecute(CommandSender sender, String[] args) {
if (sender instanceof Player && sender.isOp()) {
((Player) sender).getInventory().addItem(SlimefunItems.DEBUG_FISH);
if (sender instanceof Player && sender.hasPermission("slimefun.debugging")) {
((Player) sender).getInventory().addItem(SlimefunItems.DEBUG_FISH.clone());
}
else {
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);

View File

@ -22,17 +22,7 @@ class GiveCommand extends SubCommand {
private static final String PLACEHOLDER_AMOUNT = "%amount%";
GiveCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
super(plugin, cmd);
}
@Override
public String getName() {
return "give";
}
@Override
public boolean isHidden() {
return false;
super(plugin, cmd, "give", false);
}
@Override

View File

@ -12,17 +12,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
class GuideCommand extends SubCommand {
GuideCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
super(plugin, cmd);
}
@Override
public String getName() {
return "guide";
}
@Override
public boolean isHidden() {
return false;
super(plugin, cmd, "guide", false);
}
@Override

View File

@ -9,17 +9,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
class HelpCommand extends SubCommand {
HelpCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
super(plugin, cmd);
}
@Override
public String getName() {
return "help";
}
@Override
public boolean isHidden() {
return false;
super(plugin, cmd, "help", false);
}
@Override

View File

@ -12,17 +12,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
class OpenGuideCommand extends SubCommand {
OpenGuideCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
super(plugin, cmd);
}
@Override
public String getName() {
return "open_guide";
}
@Override
public boolean isHidden() {
return false;
super(plugin, cmd, "open_guide", false);
}
@Override

View File

@ -19,17 +19,7 @@ class ResearchCommand extends SubCommand {
private static final String PLACEHOLDER_RESEARCH = "%research%";
ResearchCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
super(plugin, cmd);
}
@Override
public String getName() {
return "research";
}
@Override
public boolean isHidden() {
return false;
super(plugin, cmd, "research", false);
}
@Override

View File

@ -14,17 +14,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
class SearchCommand extends SubCommand {
SearchCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
super(plugin, cmd);
}
@Override
public String getName() {
return "search";
}
@Override
public boolean isHidden() {
return false;
super(plugin, cmd, "search", false);
}
@Override

View File

@ -15,17 +15,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
class StatsCommand extends SubCommand {
StatsCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
super(plugin, cmd);
}
@Override
public String getName() {
return "stats";
}
@Override
public boolean isHidden() {
return false;
super(plugin, cmd, "stats", false);
}
@Override

View File

@ -13,17 +13,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
class TeleporterCommand extends SubCommand {
TeleporterCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
super(plugin, cmd);
}
@Override
public String getName() {
return "teleporter";
}
@Override
public boolean isHidden() {
return false;
super(plugin, cmd, "teleporter", false);
}
@Override

View File

@ -10,17 +10,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
class TimingsCommand extends SubCommand {
TimingsCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
super(plugin, cmd);
}
@Override
public String getName() {
return "timings";
}
@Override
public boolean isHidden() {
return false;
super(plugin, cmd, "timings", false);
}
@Override

View File

@ -2,32 +2,23 @@ package io.github.thebusybiscuit.slimefun4.core.commands.subcommands;
import java.util.Collection;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.plugin.Plugin;
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 io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.plugin.Plugin;
import io.papermc.lib.PaperLib;
class VersionsCommand extends SubCommand {
VersionsCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
super(plugin, cmd);
}
@Override
public String getName() {
return "versions";
}
@Override
public boolean isHidden() {
return false;
super(plugin, cmd, "versions", false);
}
@Override
@ -37,8 +28,8 @@ class VersionsCommand extends SubCommand {
// so we will just fix this inconsistency for them :)
String serverSoftware = PaperLib.isSpigot() && !PaperLib.isPaper() ? "Spigot" : Bukkit.getName();
sender.sendMessage(ChatColor.GRAY + "This Server uses the following setup of Slimefun:");
sender.sendMessage(ChatColors.color("&a" + serverSoftware + " &2" + ReflectionUtils.getVersion()));
sender.sendMessage("");
sender.sendMessage(ChatColors.color("&aCS-CoreLib &2v" + SlimefunPlugin.getCSCoreLibVersion()));
sender.sendMessage(ChatColors.color("&aSlimefun &2v" + SlimefunPlugin.getVersion()));
@ -47,20 +38,22 @@ class VersionsCommand extends SubCommand {
}
if (SlimefunPlugin.getRegistry().isBackwardsCompatible()) {
sender.sendMessage(ChatColor.YELLOW + "Backwards compatibility enabled!");
sender.sendMessage(ChatColor.RED + "Backwards compatibility enabled!");
}
sender.sendMessage("");
Collection<Plugin> addons = SlimefunPlugin.getInstalledAddons();
sender.sendMessage(ChatColors.color("&7Installed Addons &8(" + addons.size() + ")"));
sender.sendMessage(ChatColors.color("&7Installed Addons: &8(" + addons.size() + ")"));
for (Plugin plugin : addons) {
String version = plugin.getDescription().getVersion();
if (Bukkit.getPluginManager().isPluginEnabled(plugin)) {
sender.sendMessage(ChatColors.color(" &a" + plugin.getName() + " &2v" + plugin.getDescription().getVersion()));
sender.sendMessage(ChatColor.GREEN + " " + plugin.getName() + ChatColor.DARK_GREEN + " v" + version);
}
else {
sender.sendMessage(ChatColors.color(" &c" + plugin.getName() + " &4v" + plugin.getDescription().getVersion()));
sender.sendMessage(ChatColor.RED + " " + plugin.getName() + ChatColor.DARK_RED + " v" + version);
}
}
}

View File

@ -175,7 +175,7 @@ public class MetricsService {
return node.getObject().getInt("tag_name");
}
catch (UnirestException e) {
plugin.getLogger().log(Level.SEVERE, "Failed to fetch latest builds for SFMetrics");
plugin.getLogger().log(Level.WARNING, "Failed to fetch latest builds for Metrics: {0}", e.getMessage());
return -1;
}
}

View File

@ -54,7 +54,18 @@ abstract class GitHubConnector {
writeCacheFile(resp.getBody());
}
else {
Slimefun.getLogger().log(Level.WARNING, "Failed to fetch {0}: {1} - {2}", new Object[] {repository + getURLSuffix(), resp.getStatus(), resp.getBody()});
if (github.isLoggingEnabled()) {
Slimefun.getLogger().log(Level.WARNING, "Failed to fetch {0}: {1} - {2}", new Object[] {repository + getURLSuffix(), resp.getStatus(), resp.getBody()});
}
// It has the cached file, let's just read that then
if (file.exists()) {
JsonNode cache = readCacheFile();
if (cache != null) {
onSuccess(cache);
}
}
}
}
catch (UnirestException e) {

View File

@ -38,6 +38,7 @@ public class Translators {
addTranslator("ThatsCube", SupportedLanguage.ITALIAN, true);
addTranslator("alessandrobasi", SupportedLanguage.ITALIAN, true);
addTranslator("dracrus", SupportedLanguage.ITALIAN, true);
addTranslator("prolletto64", SupportedLanguage.ITALIAN, true);
// Translators - Latvian
addTranslator("AgnisT", "NIKNAIZ", SupportedLanguage.LATVIAN, true);

View File

@ -144,11 +144,11 @@ public final class SlimefunItems {
public static final SlimefunItemStack DIET_COOKIE = new SlimefunItemStack("DIET_COOKIE", Material.COOKIE, "&6Diet Cookie", "", "&aA very &olightweight &f&acookie.");
public static final SlimefunItemStack MAGIC_SUGAR = new SlimefunItemStack("MAGIC_SUGAR", Material.SUGAR, "&6Magic Sugar", "", "&a&oFeel the Power of Hermes!");
public static final SlimefunItemStack MONSTER_JERKY = new SlimefunItemStack("MONSTER_JERKY", Material.ROTTEN_FLESH, "&6Monster Jerky", "", "&a&oNo longer hungry");
public static final SlimefunItemStack APPLE_JUICE = new SlimefunItemStack("APPLE_JUICE", Color.RED, new PotionEffect(PotionEffectType.SATURATION, 6, 0), "&cApple Juice", "", "&7&oRestores &b&o" + "3.0" + " &7&oHunger");
public static final SlimefunItemStack MELON_JUICE = new SlimefunItemStack("MELON_JUICE", Color.RED, new PotionEffect(PotionEffectType.SATURATION, 6, 0), "&cMelon Juice", "", "&7&oRestores &b&o" + "3.0" + " &7&oHunger");
public static final SlimefunItemStack CARROT_JUICE = new SlimefunItemStack("CARROT_JUICE", Color.ORANGE, new PotionEffect(PotionEffectType.SATURATION, 6, 0), "&6Carrot Juice", "", "&7&oRestores &b&o" + "3.0" + " &7&oHunger");
public static final SlimefunItemStack PUMPKIN_JUICE = new SlimefunItemStack("PUMPKIN_JUICE", Color.ORANGE, new PotionEffect(PotionEffectType.SATURATION, 6, 0), "&6Pumpkin Juice", "", "&7&oRestores &b&o" + "3.0" + " &7&oHunger");
public static final SlimefunItemStack SWEET_BERRY_JUICE = new SlimefunItemStack("SWEET_BERRY_JUICE", Color.RED, new PotionEffect(PotionEffectType.SATURATION, 6, 0), "&cSweet Berry Juice", "", "&7&oRestores &b&o" + "3.0" + " &7&oHunger");
public static final SlimefunItemStack APPLE_JUICE = new SlimefunItemStack("APPLE_JUICE", Color.RED, new PotionEffect(PotionEffectType.SATURATION, 6, 0), "&cApple Juice", "", LoreBuilder.hunger(3));
public static final SlimefunItemStack MELON_JUICE = new SlimefunItemStack("MELON_JUICE", Color.RED, new PotionEffect(PotionEffectType.SATURATION, 6, 0), "&cMelon Juice", "", LoreBuilder.hunger(3));
public static final SlimefunItemStack CARROT_JUICE = new SlimefunItemStack("CARROT_JUICE", Color.ORANGE, new PotionEffect(PotionEffectType.SATURATION, 6, 0), "&6Carrot Juice", "", LoreBuilder.hunger(3));
public static final SlimefunItemStack PUMPKIN_JUICE = new SlimefunItemStack("PUMPKIN_JUICE", Color.ORANGE, new PotionEffect(PotionEffectType.SATURATION, 6, 0), "&6Pumpkin Juice", "", LoreBuilder.hunger(3));
public static final SlimefunItemStack SWEET_BERRY_JUICE = new SlimefunItemStack("SWEET_BERRY_JUICE", Color.RED, new PotionEffect(PotionEffectType.SATURATION, 6, 0), "&cSweet Berry Juice", "", LoreBuilder.hunger(3));
public static final SlimefunItemStack GOLDEN_APPLE_JUICE = new SlimefunItemStack("GOLDEN_APPLE_JUICE", Color.YELLOW, new PotionEffect(PotionEffectType.ABSORPTION, 20 * 20, 0), "&bGolden Apple Juice");
public static final SlimefunItemStack BEEF_JERKY = new SlimefunItemStack("BEEF_JERKY", Material.COOKED_BEEF, "&6Beef Jerky", "", "&fExtra saturating!");
@ -161,14 +161,14 @@ public final class SlimefunItems {
public static final SlimefunItemStack KELP_COOKIE = new SlimefunItemStack("KELP_COOKIE", Material.COOKIE, "&2Kelp Cookie");
/* Christmas */
public static final SlimefunItemStack CHRISTMAS_MILK = new SlimefunItemStack("CHRISTMAS_MILK", Color.WHITE, new PotionEffect(PotionEffectType.SATURATION, 5, 0), "&6Glass of Milk", "", "&7&oRestores &b&o" + "2.5" + " &7&oHunger");
public static final SlimefunItemStack CHRISTMAS_CHOCOLATE_MILK = new SlimefunItemStack("CHRISTMAS_CHOCOLATE_MILK", Color.MAROON, new PotionEffect(PotionEffectType.SATURATION, 12, 0), "&6Chocolate Milk", "", "&7&oRestores &b&o" + "6.0" + " &7&oHunger");
public static final SlimefunItemStack CHRISTMAS_EGG_NOG = new SlimefunItemStack("CHRISTMAS_EGG_NOG", Color.GRAY, new PotionEffect(PotionEffectType.SATURATION, 7, 0), "&aEgg Nog", "", "&7&oRestores &b&o" + "3.5" + " &7&oHunger");
public static final SlimefunItemStack CHRISTMAS_APPLE_CIDER = new SlimefunItemStack("CHRISTMAS_APPLE_CIDER", Color.RED, new PotionEffect(PotionEffectType.SATURATION, 14, 0), "&cApple Cider", "", "&7&oRestores &b&o" + "7.0" + " &7&oHunger");
public static final SlimefunItemStack CHRISTMAS_MILK = new SlimefunItemStack("CHRISTMAS_MILK", Color.WHITE, new PotionEffect(PotionEffectType.SATURATION, 5, 0), "&6Glass of Milk", "", LoreBuilder.hunger(2.5));
public static final SlimefunItemStack CHRISTMAS_CHOCOLATE_MILK = new SlimefunItemStack("CHRISTMAS_CHOCOLATE_MILK", Color.MAROON, new PotionEffect(PotionEffectType.SATURATION, 12, 0), "&6Chocolate Milk", "", LoreBuilder.hunger(6));
public static final SlimefunItemStack CHRISTMAS_EGG_NOG = new SlimefunItemStack("CHRISTMAS_EGG_NOG", Color.GRAY, new PotionEffect(PotionEffectType.SATURATION, 7, 0), "&aEgg Nog", "", LoreBuilder.hunger(3.5));
public static final SlimefunItemStack CHRISTMAS_APPLE_CIDER = new SlimefunItemStack("CHRISTMAS_APPLE_CIDER", Color.RED, new PotionEffect(PotionEffectType.SATURATION, 14, 0), "&cApple Cider", "", LoreBuilder.hunger(7));
public static final SlimefunItemStack CHRISTMAS_COOKIE = new SlimefunItemStack("CHRISTMAS_COOKIE", Material.COOKIE, ChatUtils.christmas("Christmas Cookie"));
public static final SlimefunItemStack CHRISTMAS_FRUIT_CAKE = new SlimefunItemStack("CHRISTMAS_FRUIT_CAKE", Material.PUMPKIN_PIE, ChatUtils.christmas("Fruit Cake"));
public static final SlimefunItemStack CHRISTMAS_APPLE_PIE = new SlimefunItemStack("CHRISTMAS_APPLE_PIE", Material.PUMPKIN_PIE, "&fApple Pie");
public static final SlimefunItemStack CHRISTMAS_HOT_CHOCOLATE = new SlimefunItemStack("CHRISTMAS_HOT_CHOCOLATE", Color.MAROON, new PotionEffect(PotionEffectType.SATURATION, 14, 0), "&6Hot Chocolate", "", "&7&oRestores &b&o" + "7.0" + " &7&oHunger");
public static final SlimefunItemStack CHRISTMAS_HOT_CHOCOLATE = new SlimefunItemStack("CHRISTMAS_HOT_CHOCOLATE", Color.MAROON, new PotionEffect(PotionEffectType.SATURATION, 14, 0), "&6Hot Chocolate", "", LoreBuilder.hunger(7));
public static final SlimefunItemStack CHRISTMAS_CAKE = new SlimefunItemStack("CHRISTMAS_CAKE", Material.PUMPKIN_PIE, ChatUtils.christmas("Christmas Cake"));
public static final SlimefunItemStack CHRISTMAS_CARAMEL = new SlimefunItemStack("CHRISTMAS_CARAMEL", Material.BRICK, "&6Caramel");
public static final SlimefunItemStack CHRISTMAS_CARAMEL_APPLE = new SlimefunItemStack("CHRISTMAS_CARAMEL_APPLE", Material.APPLE, "&6Caramel Apple");
@ -755,28 +755,28 @@ public final class SlimefunItems {
public static final SlimefunItemStack AUTO_BREEDER = new SlimefunItemStack("AUTO_BREEDER", Material.HAY_BLOCK, "&eAuto-Breeder", "", "&fRuns on &aOrganic Food", "", LoreBuilder.machine(MachineTier.END_GAME, MachineType.MACHINE), LoreBuilder.powerBuffer(1024), "&8\u21E8 &e\u26A1 &760 J/Animal");
public static final SlimefunItemStack ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD", HeadTexture.FILLED_CAN, "&aOrganic Food", "&7Content: &9???");
public static final SlimefunItemStack WHEAT_ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD_WHEAT", HeadTexture.FILLED_CAN, "&aOrganic Food", "&7Content: &9Wheat");
public static final SlimefunItemStack CARROT_ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD_CARROT", HeadTexture.FILLED_CAN, "&aOrganic Food", "&7Content: &9Carrots");
public static final SlimefunItemStack POTATO_ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD_POTATO", HeadTexture.FILLED_CAN, "&aOrganic Food", "&7Content: &9Potatoes");
public static final SlimefunItemStack SEEDS_ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD_SEEDS", HeadTexture.FILLED_CAN, "&aOrganic Food", "&7Content: &9Seeds");
public static final SlimefunItemStack BEETROOT_ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD_BEETROOT", HeadTexture.FILLED_CAN, "&aOrganic Food", "&7Content: &9Beetroot");
public static final SlimefunItemStack MELON_ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD_MELON", HeadTexture.FILLED_CAN, "&aOrganic Food", "&7Content: &9Melon");
public static final SlimefunItemStack APPLE_ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD_APPLE", HeadTexture.FILLED_CAN, "&aOrganic Food", "&7Content: &9Apple");
public static final SlimefunItemStack SWEET_BERRIES_ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD_SWEET_BERRIES", HeadTexture.FILLED_CAN, "&aOrganic Food", "&7Content: &9Sweet Berries");
public static final SlimefunItemStack KELP_ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD_KELP", HeadTexture.FILLED_CAN, "&aOrganic Food", "&7Content: &9Dried Kelp");
public static final SlimefunItemStack COCOA_ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD_COCOA", HeadTexture.FILLED_CAN, "&aOrganic Food", "&7Content: &9Cocoa Beans");
public static final SlimefunItemStack WHEAT_ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD_WHEAT", HeadTexture.FILLED_CAN, ORGANIC_FOOD.getDisplayName(), "&7Content: &9Wheat");
public static final SlimefunItemStack CARROT_ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD_CARROT", HeadTexture.FILLED_CAN, ORGANIC_FOOD.getDisplayName(), "&7Content: &9Carrots");
public static final SlimefunItemStack POTATO_ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD_POTATO", HeadTexture.FILLED_CAN, ORGANIC_FOOD.getDisplayName(), "&7Content: &9Potatoes");
public static final SlimefunItemStack SEEDS_ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD_SEEDS", HeadTexture.FILLED_CAN, ORGANIC_FOOD.getDisplayName(), "&7Content: &9Seeds");
public static final SlimefunItemStack BEETROOT_ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD_BEETROOT", HeadTexture.FILLED_CAN, ORGANIC_FOOD.getDisplayName(), "&7Content: &9Beetroot");
public static final SlimefunItemStack MELON_ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD_MELON", HeadTexture.FILLED_CAN, ORGANIC_FOOD.getDisplayName(), "&7Content: &9Melon");
public static final SlimefunItemStack APPLE_ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD_APPLE", HeadTexture.FILLED_CAN, ORGANIC_FOOD.getDisplayName(), "&7Content: &9Apple");
public static final SlimefunItemStack SWEET_BERRIES_ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD_SWEET_BERRIES", HeadTexture.FILLED_CAN, ORGANIC_FOOD.getDisplayName(), "&7Content: &9Sweet Berries");
public static final SlimefunItemStack KELP_ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD_KELP", HeadTexture.FILLED_CAN, ORGANIC_FOOD.getDisplayName(), "&7Content: &9Dried Kelp");
public static final SlimefunItemStack COCOA_ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD_COCOA", HeadTexture.FILLED_CAN, ORGANIC_FOOD.getDisplayName(), "&7Content: &9Cocoa Beans");
public static final SlimefunItemStack FERTILIZER = new SlimefunItemStack("FERTILIZER", HeadTexture.FILLED_CAN, "&aOrganic Fertilizer", "&7Content: &9???");
public static final SlimefunItemStack WHEAT_FERTILIZER = new SlimefunItemStack("FERTILIZER_WHEAT", HeadTexture.FILLED_CAN, "&aOrganic Fertilizer", "&7Content: &9Wheat");
public static final SlimefunItemStack CARROT_FERTILIZER = new SlimefunItemStack("FERTILIZER_CARROT", HeadTexture.FILLED_CAN, "&aOrganic Fertilizer", "&7Content: &9Carrots");
public static final SlimefunItemStack POTATO_FERTILIZER = new SlimefunItemStack("FERTILIZER_POTATO", HeadTexture.FILLED_CAN, "&aOrganic Fertilizer", "&7Content: &9Potatoes");
public static final SlimefunItemStack SEEDS_FERTILIZER = new SlimefunItemStack("FERTILIZER_SEEDS", HeadTexture.FILLED_CAN, "&aOrganic Fertilizer", "&7Content: &9Seeds");
public static final SlimefunItemStack BEETROOT_FERTILIZER = new SlimefunItemStack("FERTILIZER_BEETROOT", HeadTexture.FILLED_CAN, "&aOrganic Fertilizer", "&7Content: &9Beetroot");
public static final SlimefunItemStack MELON_FERTILIZER = new SlimefunItemStack("FERTILIZER_MELON", HeadTexture.FILLED_CAN, "&aOrganic Fertilizer", "&7Content: &9Melon");
public static final SlimefunItemStack APPLE_FERTILIZER = new SlimefunItemStack("FERTILIZER_APPLE", HeadTexture.FILLED_CAN, "&aOrganic Fertilizer", "&7Content: &9Apple");
public static final SlimefunItemStack SWEET_BERRIES_FERTILIZER = new SlimefunItemStack("FERTILIZER_SWEET_BERRIES", HeadTexture.FILLED_CAN, "&aOrganic Fertilizer", "&7Content: &9Sweet Berries");
public static final SlimefunItemStack KELP_FERTILIZER = new SlimefunItemStack("FERTILIZER_KELP", HeadTexture.FILLED_CAN, "&aOrganic Fertilizer", "&7Content: &9Dried Kelp");
public static final SlimefunItemStack COCOA_FERTILIZER = new SlimefunItemStack("FERTILIZER_COCOA", HeadTexture.FILLED_CAN, "&aOrganic Fertilizer", "&7Content: &9Cocoa beans");
public static final SlimefunItemStack WHEAT_FERTILIZER = new SlimefunItemStack("FERTILIZER_WHEAT", HeadTexture.FILLED_CAN, FERTILIZER.getDisplayName(), "&7Content: &9Wheat");
public static final SlimefunItemStack CARROT_FERTILIZER = new SlimefunItemStack("FERTILIZER_CARROT", HeadTexture.FILLED_CAN, FERTILIZER.getDisplayName(), "&7Content: &9Carrots");
public static final SlimefunItemStack POTATO_FERTILIZER = new SlimefunItemStack("FERTILIZER_POTATO", HeadTexture.FILLED_CAN, FERTILIZER.getDisplayName(), "&7Content: &9Potatoes");
public static final SlimefunItemStack SEEDS_FERTILIZER = new SlimefunItemStack("FERTILIZER_SEEDS", HeadTexture.FILLED_CAN, FERTILIZER.getDisplayName(), "&7Content: &9Seeds");
public static final SlimefunItemStack BEETROOT_FERTILIZER = new SlimefunItemStack("FERTILIZER_BEETROOT", HeadTexture.FILLED_CAN, FERTILIZER.getDisplayName(), "&7Content: &9Beetroot");
public static final SlimefunItemStack MELON_FERTILIZER = new SlimefunItemStack("FERTILIZER_MELON", HeadTexture.FILLED_CAN, FERTILIZER.getDisplayName(), "&7Content: &9Melon");
public static final SlimefunItemStack APPLE_FERTILIZER = new SlimefunItemStack("FERTILIZER_APPLE", HeadTexture.FILLED_CAN, FERTILIZER.getDisplayName(), "&7Content: &9Apple");
public static final SlimefunItemStack SWEET_BERRIES_FERTILIZER = new SlimefunItemStack("FERTILIZER_SWEET_BERRIES", HeadTexture.FILLED_CAN, FERTILIZER.getDisplayName(), "&7Content: &9Sweet Berries");
public static final SlimefunItemStack KELP_FERTILIZER = new SlimefunItemStack("FERTILIZER_KELP", HeadTexture.FILLED_CAN, FERTILIZER.getDisplayName(), "&7Content: &9Dried Kelp");
public static final SlimefunItemStack COCOA_FERTILIZER = new SlimefunItemStack("FERTILIZER_COCOA", HeadTexture.FILLED_CAN, FERTILIZER.getDisplayName(), "&7Content: &9Cocoa beans");
public static final SlimefunItemStack ANIMAL_GROWTH_ACCELERATOR = new SlimefunItemStack("ANIMAL_GROWTH_ACCELERATOR", Material.HAY_BLOCK, "&bAnimal Growth Accelerator", "", "&fRuns on &aOrganic Food", "", LoreBuilder.machine(MachineTier.END_GAME, MachineType.MACHINE), LoreBuilder.powerBuffer(1024), LoreBuilder.powerPerSecond(28));
public static final SlimefunItemStack CROP_GROWTH_ACCELERATOR = new SlimefunItemStack("CROP_GROWTH_ACCELERATOR", Material.LIME_TERRACOTTA, "&aCrop Growth Accelerator", "", "&fRuns on &aOrganic Fertilizer", "", LoreBuilder.machine(MachineTier.END_GAME, MachineType.MACHINE), "&8\u21E8 &7Radius: 7x7", "&8\u21E8 &7Speed: &a3/time", LoreBuilder.powerBuffer(1024), LoreBuilder.powerPerSecond(50));

View File

@ -43,10 +43,29 @@ public class RadioactiveItem extends SlimefunItem implements Radioactive, NotPla
* The recipe of how to craft this {@link SlimefunItem}
*/
public RadioactiveItem(Category category, Radioactivity radioactivity, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
this(category, radioactivity, item, recipeType, recipe, null);
}
/**
* This will create a new {@link RadioactiveItem} with the given level of {@link Radioactivity}
*
* @param category
* The {@link Category} of this {@link SlimefunItem}
* @param radioactivity
* the level of {@link Radioactivity}
* @param item
* the {@link SlimefunItemStack} this {@link SlimefunItem} represents
* @param recipeType
* The {@link RecipeType} for this item
* @param recipe
* The recipe of how to craft this {@link SlimefunItem}
* @param recipeOutput
* The recipe output
*/
public RadioactiveItem(Category category, Radioactivity radioactivity, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, ItemStack recipeOutput) {
super(category, item, recipeType, recipe, recipeOutput);
this.radioactivity = radioactivity;
addItemHandler(onRightClick());
}

View File

@ -19,10 +19,12 @@ import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.core.researching.Research;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
@ -150,9 +152,9 @@ public class Talisman extends SlimefunItem {
ItemStack talismanItem = talisman.getItem();
if (p.getInventory().containsAtLeast(talismanItem, 1)) {
if (Slimefun.hasUnlocked(p, talismanItem, true)) {
activateTalisman(e, p, p.getInventory(), talisman, talismanItem);
if (SlimefunUtils.containsSimilarItem(p.getInventory(), talismanItem, true)) {
if (Slimefun.hasUnlocked(p, talisman, true)) {
activateTalisman(e, p, p.getInventory(), talisman);
return true;
}
else {
@ -162,9 +164,9 @@ public class Talisman extends SlimefunItem {
else {
ItemStack enderTalisman = talisman.getEnderVariant();
if (p.getEnderChest().containsAtLeast(enderTalisman, 1)) {
if (Slimefun.hasUnlocked(p, enderTalisman, true)) {
activateTalisman(e, p, p.getEnderChest(), talisman, enderTalisman);
if (SlimefunUtils.containsSimilarItem(p.getEnderChest(), enderTalisman, true)) {
if (Slimefun.hasUnlocked(p, talisman, true)) {
activateTalisman(e, p, p.getEnderChest(), talisman);
return true;
}
else {
@ -177,12 +179,11 @@ public class Talisman extends SlimefunItem {
}
}
private static void activateTalisman(Event e, Player p, Inventory inv, Talisman talisman, ItemStack talismanItem) {
consumeItem(inv, talisman, talismanItem);
private static void activateTalisman(Event e, Player p, Inventory inv, Talisman talisman) {
consumeItem(inv, talisman);
applyTalismanEffects(p, talisman);
cancelEvent(e, talisman);
sendMessage(p, talisman);
}
private static void applyTalismanEffects(Player p, Talisman talisman) {
@ -203,9 +204,17 @@ public class Talisman extends SlimefunItem {
}
}
private static void consumeItem(Inventory inv, Talisman talisman, ItemStack talismanItem) {
private static void consumeItem(Inventory inv, Talisman talisman) {
if (talisman.isConsumable()) {
inv.removeItem(talismanItem);
ItemStack[] contents = inv.getContents();
for (int i = 0; i < contents.length; i++) {
ItemStack item = contents[i];
if (SlimefunUtils.isItemSimilar(item, talisman.getItem(), true, false)) {
ItemUtils.consumeItem(item, false);
return;
}
}
}
}

View File

@ -34,6 +34,18 @@ public class OreWasher extends MultiBlockMachine {
legacyMode = SlimefunPlugin.getCfg().getBoolean("options.legacy-ore-washer");
dusts = new ItemStack[] { SlimefunItems.IRON_DUST, SlimefunItems.GOLD_DUST, SlimefunItems.COPPER_DUST, SlimefunItems.TIN_DUST, SlimefunItems.ZINC_DUST, SlimefunItems.ALUMINUM_DUST, SlimefunItems.MAGNESIUM_DUST, SlimefunItems.LEAD_DUST, SlimefunItems.SILVER_DUST };
}
@Override
protected void registerDefaultRecipes(List<ItemStack> recipes) {
// Iron and Gold are displayed as Ore Crusher recipes, as that is their primary
// way of obtainining them. But we also wanna display them here, so we just
// add these two recipes manually
recipes.add(SlimefunItems.SIFTED_ORE);
recipes.add(SlimefunItems.IRON_DUST);
recipes.add(SlimefunItems.SIFTED_ORE);
recipes.add(SlimefunItems.GOLD_DUST);
}
@Override
public List<ItemStack> getDisplayRecipes() {

View File

@ -29,6 +29,7 @@ import org.bukkit.util.Vector;
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.slimefun4.api.events.PlayerRightClickEvent;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
@ -128,6 +129,11 @@ public class AncientAltarListener implements Listener {
return;
}
if (!SlimefunPlugin.getProtectionManager().hasPermission(p, pedestal, ProtectableAction.ACCESS_INVENTORIES)) {
SlimefunPlugin.getLocalization().sendMessage(p, "inventory.no-access", true);
return;
}
// getting the currently placed item
Item stack = findItem(pedestal);
@ -157,6 +163,11 @@ public class AncientAltarListener implements Listener {
}
private void useAltar(Block altar, Player p) {
if (!SlimefunPlugin.getProtectionManager().hasPermission(p, altar, ProtectableAction.ACCESS_INVENTORIES)) {
SlimefunPlugin.getLocalization().sendMessage(p, "inventory.no-access", true);
return;
}
ItemStack catalyst = new CustomItem(p.getInventory().getItemInMainHand(), 1);
List<Block> pedestals = getPedestals(altar);

View File

@ -1,5 +1,7 @@
package io.github.thebusybiscuit.slimefun4.implementation.listeners;
import java.util.logging.Level;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Skull;
@ -23,8 +25,16 @@ import io.github.thebusybiscuit.slimefun4.utils.HeadTexture;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.Slimefun;
import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock;
/**
* This {@link Listener} is responsible for handling our debugging tool, the debug fish.
* This is where the functionality of this item is implemented.
*
* @author TheBusyBiscuit
*
*/
public class DebugFishListener implements Listener {
private final String greenCheckmark;
@ -45,28 +55,38 @@ public class DebugFishListener implements Listener {
Player p = e.getPlayer();
if (p.isOp() && SlimefunUtils.isItemSimilar(e.getItem(), SlimefunItems.DEBUG_FISH, true)) {
if (SlimefunUtils.isItemSimilar(e.getItem(), SlimefunItems.DEBUG_FISH, true, false)) {
e.setCancelled(true);
if (e.getAction() == Action.LEFT_CLICK_BLOCK) {
if (p.isSneaking()) {
if (BlockStorage.hasBlockInfo(e.getClickedBlock())) {
BlockStorage.clearBlockInfo(e.getClickedBlock());
if (p.hasPermission("slimefun.debugging")) {
if (e.getAction() == Action.LEFT_CLICK_BLOCK) {
if (p.isSneaking()) {
if (BlockStorage.hasBlockInfo(e.getClickedBlock())) {
BlockStorage.clearBlockInfo(e.getClickedBlock());
}
}
else {
e.setCancelled(false);
}
}
else {
e.setCancelled(false);
else if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (p.isSneaking()) {
Block b = e.getClickedBlock().getRelative(e.getBlockFace());
b.setType(Material.PLAYER_HEAD);
SkullBlock.setFromHash(b, HeadTexture.MISSING_TEXTURE.getTexture());
}
else if (BlockStorage.hasBlockInfo(e.getClickedBlock())) {
try {
sendInfo(p, e.getClickedBlock());
}
catch (Exception x) {
Slimefun.getLogger().log(Level.SEVERE, "An Exception occured while using a Debug-Fish", x);
}
}
}
}
else if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (p.isSneaking()) {
Block b = e.getClickedBlock().getRelative(e.getBlockFace());
b.setType(Material.PLAYER_HEAD);
SkullBlock.setFromHash(b, HeadTexture.MISSING_TEXTURE.getTexture());
}
else if (BlockStorage.hasBlockInfo(e.getClickedBlock())) {
sendInfo(p, e.getClickedBlock());
}
else {
SlimefunPlugin.getLocalization().sendMessage(p, "messages.no-permission", true);
}
}
}
@ -108,7 +128,7 @@ public class DebugFishListener implements Listener {
else {
p.sendMessage(ChatColors.color("&dTicking: " + redCross));
}
if (SlimefunPlugin.getProfiler().hasTimings(b)) {
p.sendMessage(ChatColors.color(" &dTimings: &e" + SlimefunPlugin.getProfiler().getTime(b)));
p.sendMessage(ChatColors.color(" &dTotal Timings: &e" + SlimefunPlugin.getProfiler().getTime(item)));

View File

@ -2781,12 +2781,12 @@ public final class SlimefunItemSetup {
.register(plugin);
new RadioactiveItem(categories.resources, Radioactivity.VERY_HIGH, SlimefunItems.ENRICHED_NETHER_ICE, RecipeType.HEATED_PRESSURE_CHAMBER,
new ItemStack[] {SlimefunItems.NETHER_ICE, SlimefunItems.PLUTONIUM, null, null, null, null, null, null, null})
.register(plugin);
new ItemStack[] {SlimefunItems.NETHER_ICE, SlimefunItems.PLUTONIUM, null, null, null, null, null, null, null},
new SlimefunItemStack(SlimefunItems.ENRICHED_NETHER_ICE, 4)).register(plugin);
new ElevatorPlate(categories.gps, SlimefunItems.ELEVATOR_PLATE, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, new ItemStack(Material.STONE_PRESSURE_PLATE), null, new ItemStack(Material.PISTON), SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.PISTON), SlimefunItems.ALUMINUM_BRONZE_INGOT, SlimefunItems.ALUMINUM_BRONZE_INGOT, SlimefunItems.ALUMINUM_BRONZE_INGOT},
new CustomItem(SlimefunItems.ELEVATOR_PLATE, 2))
new SlimefunItemStack(SlimefunItems.ELEVATOR_PLATE, 2))
.register(plugin);
new FoodFabricator(categories.electricity, SlimefunItems.FOOD_FABRICATOR, RecipeType.ENHANCED_CRAFTING_TABLE,
@ -3023,7 +3023,7 @@ public final class SlimefunItemSetup {
new CoolantCell(categories.technicalComponents, SlimefunItems.NETHER_ICE_COOLANT_CELL, RecipeType.HEATED_PRESSURE_CHAMBER,
new ItemStack[] {SlimefunItems.ENRICHED_NETHER_ICE, null, null, null, null, null, null, null, null},
new SlimefunItemStack(SlimefunItems.NETHER_ICE_COOLANT_CELL, 4))
new SlimefunItemStack(SlimefunItems.NETHER_ICE_COOLANT_CELL, 8))
.register(plugin);
new RadioactiveItem(categories.resources, Radioactivity.HIGH, SlimefunItems.NEPTUNIUM, RecipeType.NUCLEAR_REACTOR,

View File

@ -1,9 +1,24 @@
package io.github.thebusybiscuit.slimefun4.utils;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Locale;
import io.github.thebusybiscuit.slimefun4.core.attributes.MachineTier;
import io.github.thebusybiscuit.slimefun4.core.attributes.MachineType;
import io.github.thebusybiscuit.slimefun4.core.attributes.Radioactivity;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
/**
* This utility class provides a few handy methods and constants to build the lore of any
* {@link SlimefunItemStack}. It is mostly used directly inside the class {@link SlimefunItems}.
*
* @author TheBusyBiscuit
*
* @see SlimefunItems
*
*/
public final class LoreBuilder {
public static final String HAZMAT_SUIT_REQUIRED = "&8\u21E8 &4Hazmat Suit required!";
@ -12,6 +27,8 @@ public final class LoreBuilder {
public static final String RIGHT_CLICK_TO_OPEN = "&eRight Click&7 to open";
public static final String CROUCH_TO_USE = "&eCrouch&7 to use";
private static final DecimalFormat hungerFormat = new DecimalFormat("#.0", DecimalFormatSymbols.getInstance(Locale.ROOT));
private LoreBuilder() {}
public static String radioactive(Radioactivity radioactivity) {
@ -46,4 +63,8 @@ public final class LoreBuilder {
return "&8\u21E8 &7Material: &b" + material;
}
public static String hunger(double value) {
return "&7&oRestores &b&o" + hungerFormat.format(value) + " &7&oHunger";
}
}

View File

@ -212,14 +212,16 @@ public final class SlimefunUtils {
}
// Performance optimization
ItemStackWrapper wrapper = new ItemStackWrapper(item);
if (!(item instanceof SlimefunItemStack)) {
item = new ItemStackWrapper(item);
}
for (ItemStack stack : inventory.getStorageContents()) {
if (stack == null || stack.getType() == Material.AIR) {
continue;
}
if (isItemSimilar(stack, wrapper, checkLore)) {
if (isItemSimilar(stack, item, checkLore, false)) {
return true;
}
}
@ -241,7 +243,6 @@ public final class SlimefunUtils {
return ((SlimefunItemStack) item).getItemId().equals(((SlimefunItemStack) sfitem).getItemId());
}
boolean sfItemHasMeta = sfitem.hasItemMeta();
if (item.hasItemMeta()) {
ItemMeta itemMeta = item.getItemMeta();
@ -255,13 +256,12 @@ public final class SlimefunUtils {
ImmutableItemMeta meta = ((SlimefunItemStack) sfitem).getImmutableMeta();
return equalsItemMeta(itemMeta, meta, checkLore);
}
if (sfItemHasMeta) {
else if (sfitem.hasItemMeta()) {
return equalsItemMeta(itemMeta, sfitem.getItemMeta(), checkLore);
}
}
else {
return !sfItemHasMeta;
return !sfitem.hasItemMeta();
}
return false;
@ -278,11 +278,17 @@ public final class SlimefunUtils {
if (itemMeta.hasLore() && itemLore.isPresent()) {
return equalsLore(itemMeta.getLore(), itemLore.get());
}
else return !itemMeta.hasLore() && !itemLore.isPresent();
else {
return !itemMeta.hasLore() && !itemLore.isPresent();
}
}
else {
return true;
}
else return true;
}
else return false;
else {
return false;
}
}
else if (!itemMeta.hasDisplayName() && !displayName.isPresent()) {
Optional<List<String>> itemLore = meta.getLore();
@ -291,9 +297,13 @@ public final class SlimefunUtils {
if (itemMeta.hasLore() && itemLore.isPresent()) {
return equalsLore(itemMeta.getLore(), itemLore.get());
}
else return !itemMeta.hasLore() && !itemLore.isPresent();
else {
return !itemMeta.hasLore() && !itemLore.isPresent();
}
}
else {
return true;
}
else return true;
}
else return false;
}
@ -305,22 +315,34 @@ public final class SlimefunUtils {
if (itemMeta.hasLore() && sfitemMeta.hasLore()) {
return equalsLore(itemMeta.getLore(), sfitemMeta.getLore());
}
else return !itemMeta.hasLore() && !sfitemMeta.hasLore();
else {
return !itemMeta.hasLore() && !sfitemMeta.hasLore();
}
}
else {
return true;
}
else return true;
}
else return false;
else {
return false;
}
}
else if (!itemMeta.hasDisplayName() && !sfitemMeta.hasDisplayName()) {
if (checkLore) {
if (itemMeta.hasLore() && sfitemMeta.hasLore()) {
return equalsLore(itemMeta.getLore(), sfitemMeta.getLore());
}
else return !itemMeta.hasLore() && !sfitemMeta.hasLore();
else {
return !itemMeta.hasLore() && !sfitemMeta.hasLore();
}
}
else {
return true;
}
else return true;
}
else return false;
else {
return false;
}
}
private static boolean equalsLore(List<String> lore, List<String> lore2) {

View File

@ -231,7 +231,7 @@ public class SlimefunItemStack extends CustomItem {
throw new WrongItemStackException(id + " is not mutable.");
}
}
public void lock() {
locked = true;
}
@ -250,6 +250,15 @@ public class SlimefunItemStack extends CustomItem {
return Optional.ofNullable(texture);
}
public String getDisplayName() {
if (immutableMeta == null) {
// Just to be extra safe
return null;
}
return immutableMeta.getDisplayName().orElse(null);
}
private static ItemStack getSkull(String id, String texture) {
if (SlimefunPlugin.getMinecraftVersion() == MinecraftVersion.UNIT_TEST) {
return new ItemStack(Material.PLAYER_HEAD);

View File

@ -3,7 +3,7 @@ options:
# These builds are much more tested and are far less likely to have any issues.
# Note: When running a stable build auto-updates ONLY update to other stable builds! Perfect eh?
# You can download the latest stable build here: https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/
auto-update: true
backwards-compatibility: true
chat-prefix: '&a&lSlimefun 4&7> '
@ -17,12 +17,12 @@ options:
language: en
enable-translations: true
log-duplicate-block-entries: true
guide:
default-view-book: false
show-vanilla-recipes: true
receive-on-first-join: true
researches:
free-in-creative-mode: true
enable-fireworks: true

View File

@ -22,4 +22,4 @@ slimefun:
valentines_day: 'Valentine''s Day (14th February)'
easter: 'Easter (April)'
birthday: 'TheBusyBiscuit''s birthday (26th October)'
halloween: 'Halloween (31st October)'
halloween: 'Halloween (31st October)'

View File

@ -152,6 +152,15 @@ messages:
- "&7Вы съели странное печенье, до жути напоминающее бисквит"
- "&7Неоновые таблички просто ШИК!"
piglin-barter: "&4Вы не можете торговать с пиглинами, используя Slimefun предметы"
enchantment-rune:
fail: "&cВы не можете зачаровать этот предмет."
no-enchantment: "&cНе удалось найти подходящее зачарование для этого предмета."
success: "&aВы успешно применили случайное зачарование к этому предмету."
tape-measure:
no-anchor: "&cВы должны установить якорь, прежде чем начать измерение!"
wrong-world: "&cВаш якорь находится в другом мире!"
distance: "&7Измерение завершено. &eРасстояние: %distance%"
anchor-set: "&aЯкорь успешно установлен:&e %anchor%"
machines:
pattern-not-found: "&eК сожалению, не удалось распознать этот рецепт. Пожалуйста,
разложите предметы в верной последовательности в раздатчик."
@ -294,7 +303,6 @@ languages:
el: Греческий
he: Иврит
pt: Португальский (Португалия)
pt-BR: Португальский (Бразилия)
ar: Арабский
af: Бурский
da: Датский
@ -306,6 +314,7 @@ languages:
fa: Персидский
th: Тайский
ro: Румынский
pt-BR: Португальский (Бразилия)
bg: Болгарский
ko: Корейский
tr: Турецкий

View File

@ -71,7 +71,7 @@ slimefun:
lore:
- I-craft ang item na ito tulad ng ipinakita
- gamit ang Ancient Altar.
- Hanapin ang Ancient Altar para sa karagdagang Impormasyon.
- Hanapin ang Ancient Altar para sa mga karagdagang Impormasyon.
heated_pressure_chamber:
name: Heated Pressure Chamber
lore:

View File

@ -238,4 +238,4 @@ slimefun:
enchantment_rune: Ancient Enchanting
lead_clothing: Lead Clothing
tape_measure: Tape Measure
iron_golem_assembler: Automated Iron Golems
iron_golem_assembler: Automated Iron Golems

View File

@ -236,3 +236,7 @@ slimefun:
advanced_industrial_miner: Улучшенная добыча
magical_zombie_pills: Дезомбификация
auto_brewer: Промышленная пивоварня
enchantment_rune: Древнее зачарование
lead_clothing: Свинцовое обмундирование
tape_measure: Рулетка
iron_golem_assembler: Образователь железных големов

View File

@ -22,4 +22,4 @@ resources:
lead_ore_chunk: 'Lead Ore Chunk'
zinc_ore_chunk: 'Zinc Ore Chunk'
nickel_ore_chunk: 'Nickel Ore Chunk'
cobalt_ore_chunk: 'Cobalt Ore Chunk'
cobalt_ore_chunk: 'Cobalt Ore Chunk'

View File

@ -58,3 +58,6 @@ permissions:
slimefun.inventory.bypass:
description: Allows you to open all Slimefun Machines
default: op
slimefun.debugging:
description: Allows you to use the debugging tool from Slimefun
default: op