mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Furnaces give XP to the last person to modify their contents
This commit is contained in:
parent
6ac1c4fa2c
commit
280971042a
@ -47,6 +47,7 @@ Version 2.1.0
|
|||||||
! (Skills) Sword's Rupture now has a max chance to proc of 33% instead of 70%
|
! (Skills) Sword's Rupture now has a max chance to proc of 33% instead of 70%
|
||||||
! (Skills) Sword's Rupture now deals 50% more damage at above Rank 3 and can last much longer! The base damage for Bleed has been increased as well (update your advanced.yml admins)
|
! (Skills) Sword's Rupture now deals 50% more damage at above Rank 3 and can last much longer! The base damage for Bleed has been increased as well (update your advanced.yml admins)
|
||||||
! (Skills) Sword's Rupture no longer triggers invincibility frames when damaging your opponent
|
! (Skills) Sword's Rupture no longer triggers invincibility frames when damaging your opponent
|
||||||
|
= (Skills) Furnaces now give XP to the last person to modify their inventory instead of the first person to open them
|
||||||
+ (Skills) Ability Lengths now have a default skill cap at which they stop increasing in length, configurable in advanced.yml (endurance perks extend this limit)
|
+ (Skills) Ability Lengths now have a default skill cap at which they stop increasing in length, configurable in advanced.yml (endurance perks extend this limit)
|
||||||
+ (Skills) Added a new subskill to some skills 'Understanding The Art' this adds nothing new, but tracks benefits that increase together that seemed unrelated, which was previously a bit obfuscated.
|
+ (Skills) Added a new subskill to some skills 'Understanding The Art' this adds nothing new, but tracks benefits that increase together that seemed unrelated, which was previously a bit obfuscated.
|
||||||
+ (Skills) Tool alerts now are sent to the Action Bar
|
+ (Skills) Tool alerts now are sent to the Action Bar
|
||||||
|
@ -34,10 +34,7 @@ import org.bukkit.GameMode;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Tag;
|
import org.bukkit.Tag;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.*;
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.block.BrewingStand;
|
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -407,6 +404,22 @@ public class BlockListener implements Listener {
|
|||||||
player.sendMessage("[mcMMO DEBUG] This block is natural");
|
player.sendMessage("[mcMMO DEBUG] This block is natural");
|
||||||
UserManager.getPlayer(player).getExcavationManager().printExcavationDebug(player, blockState);
|
UserManager.getPlayer(player).getExcavationManager().printExcavationDebug(player, blockState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(blockState instanceof Furnace)
|
||||||
|
{
|
||||||
|
Furnace furnace = (Furnace) blockState;
|
||||||
|
if(furnace.hasMetadata(mcMMO.furnaceMetadataKey))
|
||||||
|
{
|
||||||
|
player.sendMessage("[mcMMO DEBUG] This furnace has a registered owner");
|
||||||
|
Player furnacePlayer = getPlayerFromFurnace(furnace.getBlock());
|
||||||
|
if(furnacePlayer != null)
|
||||||
|
{
|
||||||
|
player.sendMessage("[mcMMO DEBUG] This furnace is owned by player "+furnacePlayer.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
player.sendMessage("[mcMMO DEBUG] This furnace does not have a registered owner");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
@ -475,6 +488,16 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Player getPlayerFromFurnace(Block furnaceBlock) {
|
||||||
|
List<MetadataValue> metadata = furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey);
|
||||||
|
|
||||||
|
if (metadata.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return plugin.getServer().getPlayerExact(metadata.get(0).asString());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle BlockDamage events where the event is modified.
|
* Handle BlockDamage events where the event is modified.
|
||||||
*
|
*
|
||||||
|
@ -39,7 +39,7 @@ public class InventoryListener implements Listener {
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onInventoryOpen(InventoryOpenEvent event) {
|
public void onInventoryOpen(InventoryOpenEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
if(WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
||||||
@ -47,7 +47,7 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
Block furnaceBlock = processInventoryOpenOrCloseEvent(event.getInventory());
|
Block furnaceBlock = processInventoryOpenOrCloseEvent(event.getInventory());
|
||||||
|
|
||||||
if (furnaceBlock == null || furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey)) {
|
if (furnaceBlock == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +57,8 @@ public class InventoryListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
furnaceBlock.setMetadata(mcMMO.furnaceMetadataKey, UserManager.getPlayer((Player) player).getPlayerMetadata());
|
if(!furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey) && furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey).size() == 0)
|
||||||
|
furnaceBlock.setMetadata(mcMMO.furnaceMetadataKey, UserManager.getPlayer((Player) player).getPlayerMetadata());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
@ -177,6 +178,22 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
Inventory inventory = event.getInventory();
|
Inventory inventory = event.getInventory();
|
||||||
|
|
||||||
|
Block furnaceBlock = processInventoryOpenOrCloseEvent(event.getInventory());
|
||||||
|
|
||||||
|
if (furnaceBlock == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(event.getWhoClicked() instanceof Player)
|
||||||
|
{
|
||||||
|
Player player = ((Player) event.getWhoClicked()).getPlayer();
|
||||||
|
|
||||||
|
if(furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey).size() > 0)
|
||||||
|
furnaceBlock.removeMetadata(mcMMO.furnaceMetadataKey, mcMMO.p);
|
||||||
|
|
||||||
|
furnaceBlock.setMetadata(mcMMO.furnaceMetadataKey, UserManager.getPlayer(player).getPlayerMetadata());
|
||||||
|
}
|
||||||
|
|
||||||
if (!(inventory instanceof BrewerInventory)) {
|
if (!(inventory instanceof BrewerInventory)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -434,7 +451,7 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
Furnace furnace = (Furnace) inventory.getHolder();
|
Furnace furnace = (Furnace) inventory.getHolder();
|
||||||
|
|
||||||
if (furnace == null || furnace.getBurnTime() != 0) {
|
if (furnace == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user