mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Debug stick tells you about placestore & treasure data when hitting blocks
This commit is contained in:
parent
43d8e08e83
commit
d84d487435
@ -66,10 +66,11 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
float skillValue = mcMMOPlayer.getSkillLevel(skill);
|
||||
|
||||
//Send the players a few blank lines to make finding the top of the skill command easier
|
||||
for(int i = 0; i < 2; i++)
|
||||
{
|
||||
player.sendMessage("");
|
||||
}
|
||||
if(AdvancedConfig.getInstance().doesSkillCommandSendBlankLines())
|
||||
for(int i = 0; i < 2; i++)
|
||||
{
|
||||
player.sendMessage("");
|
||||
}
|
||||
|
||||
permissionsCheck(player);
|
||||
dataCalculations(player, skillValue);
|
||||
|
@ -737,6 +737,12 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
/* Notification Settings */
|
||||
|
||||
public boolean doesSkillCommandSendBlankLines()
|
||||
{
|
||||
return config.getBoolean("Feedback.SkillCommand.BlankLinesAboveHeader", true);
|
||||
}
|
||||
|
||||
public boolean doesNotificationUseActionBar(NotificationType notificationType)
|
||||
{
|
||||
return config.getBoolean("Feedback.ActionBarNotifications."+notificationType.toString()+".Enabled", true);
|
||||
|
@ -3,6 +3,7 @@ package com.gmail.nossr50.listeners;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.HiddenConfig;
|
||||
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.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||
@ -394,6 +395,20 @@ public class BlockListener implements Listener {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
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 */
|
||||
if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||
return;
|
||||
@ -408,15 +423,11 @@ public class BlockListener implements Listener {
|
||||
if (event instanceof FakeBlockDamageEvent) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
BlockState blockState = event.getBlock().getState();
|
||||
|
||||
/*
|
||||
* ABILITY PREPARATION CHECKS
|
||||
|
@ -11,8 +11,12 @@ import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||
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.block.BlockState;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -49,6 +53,33 @@ public class ExcavationManager extends SkillManager {
|
||||
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.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user