Debug stick tells you about placestore & treasure data when hitting blocks

This commit is contained in:
nossr50 2019-01-26 08:14:06 -08:00
parent 43d8e08e83
commit d84d487435
4 changed files with 57 additions and 8 deletions

View File

@ -66,6 +66,7 @@ public abstract class SkillCommand implements TabExecutor {
float skillValue = mcMMOPlayer.getSkillLevel(skill); float skillValue = mcMMOPlayer.getSkillLevel(skill);
//Send the players a few blank lines to make finding the top of the skill command easier //Send the players a few blank lines to make finding the top of the skill command easier
if(AdvancedConfig.getInstance().doesSkillCommandSendBlankLines())
for(int i = 0; i < 2; i++) for(int i = 0; i < 2; i++)
{ {
player.sendMessage(""); player.sendMessage("");

View File

@ -737,6 +737,12 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
} }
/* Notification Settings */ /* Notification Settings */
public boolean doesSkillCommandSendBlankLines()
{
return config.getBoolean("Feedback.SkillCommand.BlankLinesAboveHeader", true);
}
public boolean doesNotificationUseActionBar(NotificationType notificationType) public boolean doesNotificationUseActionBar(NotificationType notificationType)
{ {
return config.getBoolean("Feedback.ActionBarNotifications."+notificationType.toString()+".Enabled", true); return config.getBoolean("Feedback.ActionBarNotifications."+notificationType.toString()+".Enabled", true);

View File

@ -3,6 +3,7 @@ package com.gmail.nossr50.listeners;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.HiddenConfig; import com.gmail.nossr50.config.HiddenConfig;
import com.gmail.nossr50.config.WorldBlacklist; import com.gmail.nossr50.config.WorldBlacklist;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType; import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
@ -394,6 +395,20 @@ public class BlockListener implements Listener {
*/ */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockDamage(BlockDamageEvent event) { public void onBlockDamage(BlockDamageEvent event) {
Player player = event.getPlayer();
BlockState blockState = event.getBlock().getState();
if(player.getInventory().getItemInMainHand().getType() == Material.DEBUG_STICK)
{
if(mcMMO.getPlaceStore().isTrue(blockState))
player.sendMessage("[mcMMO DEBUG] This block is not natural and does not reward treasures/XP");
else
{
player.sendMessage("[mcMMO DEBUG] This block is natural");
UserManager.getPlayer(player).getExcavationManager().printExcavationDebug(player, blockState);
}
}
/* WORLD BLACKLIST CHECK */ /* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld())) if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
return; return;
@ -408,15 +423,11 @@ public class BlockListener implements Listener {
if (event instanceof FakeBlockDamageEvent) { if (event instanceof FakeBlockDamageEvent) {
return; return;
} }
Player player = event.getPlayer();
if (!UserManager.hasPlayerDataKey(player)) { if (!UserManager.hasPlayerDataKey(player)) {
return; return;
} }
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
BlockState blockState = event.getBlock().getState();
/* /*
* ABILITY PREPARATION CHECKS * ABILITY PREPARATION CHECKS

View File

@ -11,8 +11,12 @@ import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.random.RandomChanceUtil; import com.gmail.nossr50.util.random.RandomChanceUtil;
import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.skills.SkillUtils;
import com.gmail.nossr50.worldguard.WorldGuardManager;
import com.gmail.nossr50.worldguard.WorldGuardUtils;
import org.apache.commons.lang.math.RandomUtils;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.entity.Player;
import java.util.List; import java.util.List;
@ -49,6 +53,33 @@ public class ExcavationManager extends SkillManager {
applyXpGain(xp, XPGainReason.PVE); applyXpGain(xp, XPGainReason.PVE);
} }
public void printExcavationDebug(Player player, BlockState blockState)
{
if (Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.EXCAVATION_ARCHAEOLOGY)) {
List<ExcavationTreasure> treasures = Excavation.getTreasures(blockState);
if (!treasures.isEmpty()) {
for (ExcavationTreasure treasure : treasures) {
player.sendMessage("|||||||||||||||||||||||||||||||||");
player.sendMessage("[mcMMO DEBUG] Treasure found: ("+treasure.getDrop().getType().toString()+")");
player.sendMessage("[mcMMO DEBUG] Drop Chance for Treasure: "+treasure.getDropChance());
player.sendMessage("[mcMMO DEBUG] Skill Level Required: "+treasure.getDropLevel());
player.sendMessage("[mcMMO DEBUG] XP for Treasure: "+treasure.getXp());
if(WorldGuardUtils.isWorldGuardLoaded())
{
if(WorldGuardManager.getInstance().hasMainFlag(player))
player.sendMessage("[mcMMO DEBUG] World Guard main flag is permitted for this player");
else
player.sendMessage("[mcMMO DEBUG] World Guard main flag is DENIED for this player");
}
}
} else {
player.sendMessage("[mcMMO DEBUG] No treasures found for this block.");
}
}
}
/** /**
* Process the Giga Drill Breaker ability. * Process the Giga Drill Breaker ability.
* *