mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
parent
31076e6ba9
commit
92efd59760
@ -3,10 +3,13 @@ Version 2.1.177
|
||||
Fixed a bug where mcMMO would fail to update a players name when it detected a name change
|
||||
mcMMO will treat vanished players as if they are offline when using the inspect command on them now (see notes)
|
||||
mcMMO now listens to PlayerFishEvent at HIGH event priority instead of HIGHEST
|
||||
Changed how vanilla treasures are overridden (AIR instead of SALMON)
|
||||
(API) Added McMMOReplaceVanillaTreasureEvent -- see notes
|
||||
|
||||
NOTES:
|
||||
A few changes were made to the inspect command, it used to reject you when used on vanished players, now it will be processed as if they are offline.
|
||||
Additionally if you do inspect a vanished player, it will not use their display name (consistent with offline players) as that would give them away for being online
|
||||
McMMOReplaceVanillaTreasureEvent is an event which is fired when mcMMO replaces a vanilla treasure with a Salmon if the server config file is set to override vanilla treasures, this causes some issues for other fishing plugins so this event helps those plugins be more compatible
|
||||
|
||||
Version 2.1.176
|
||||
Another fix for Double Smelt bringing item stack size to illegal values
|
||||
|
@ -0,0 +1,41 @@
|
||||
package com.gmail.nossr50.events;
|
||||
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class McMMOReplaceVanillaTreasureEvent extends Event {
|
||||
private @NotNull ItemStack replacementItemStack;
|
||||
private final @NotNull Item originalItem;
|
||||
|
||||
public McMMOReplaceVanillaTreasureEvent(@NotNull Item originalItem, @NotNull ItemStack replacementItemStack) {
|
||||
this.originalItem = originalItem;
|
||||
this.replacementItemStack = replacementItemStack;
|
||||
}
|
||||
|
||||
/** Rest of file is required boilerplate for custom events **/
|
||||
private static final @NotNull HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public @NotNull HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static @NotNull HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public @NotNull ItemStack getReplacementItemStack() {
|
||||
return replacementItemStack;
|
||||
}
|
||||
|
||||
public void setReplacementItemStack(@NotNull ItemStack replacementItemStack) {
|
||||
this.replacementItemStack = replacementItemStack;
|
||||
}
|
||||
|
||||
public @NotNull Item getOriginalItem() {
|
||||
return originalItem;
|
||||
}
|
||||
}
|
@ -8,6 +8,7 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.subskills.taming.CallOfTheWildType;
|
||||
import com.gmail.nossr50.events.McMMOReplaceVanillaTreasureEvent;
|
||||
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
@ -291,12 +292,20 @@ public class PlayerListener implements Listener {
|
||||
if(event.getCaught() != null) {
|
||||
Item fishingCatch = (Item) event.getCaught();
|
||||
|
||||
if (Config.getInstance(). getFishingOverrideTreasures() &&
|
||||
if (Config.getInstance().getFishingOverrideTreasures() &&
|
||||
fishingCatch.getItemStack().getType() != Material.SALMON &&
|
||||
fishingCatch.getItemStack().getType() != Material.COD &&
|
||||
fishingCatch.getItemStack().getType() != Material.TROPICAL_FISH &&
|
||||
fishingCatch.getItemStack().getType() != Material.PUFFERFISH) {
|
||||
fishingCatch.setItemStack(new ItemStack(Material.SALMON, 1));
|
||||
|
||||
ItemStack replacementCatch = new ItemStack(Material.AIR);
|
||||
|
||||
McMMOReplaceVanillaTreasureEvent replaceVanillaTreasureEvent = new McMMOReplaceVanillaTreasureEvent(fishingCatch, replacementCatch);
|
||||
Bukkit.getPluginManager().callEvent(replaceVanillaTreasureEvent);
|
||||
|
||||
//Replace
|
||||
replacementCatch = replaceVanillaTreasureEvent.getReplacementItemStack();
|
||||
fishingCatch.setItemStack(replacementCatch);
|
||||
}
|
||||
|
||||
if (Permissions.vanillaXpBoost(player, PrimarySkillType.FISHING)) {
|
||||
|
Loading…
Reference in New Issue
Block a user