1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00
This commit is contained in:
TheBusyBiscuit 2020-07-31 20:14:48 +02:00
parent 65cebf55db
commit 446191d4bf
3 changed files with 39 additions and 17 deletions

View File

@ -66,6 +66,7 @@
* Fixed Talismans sometimes not getting consumed properly
* Fixed old Infused Magnets not working
* Fixed old GPS Emergency Transmitters not working
* Fixed #2156
## Release Candidate 14 (12 Jul 2020)

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

@ -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)));