mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
Change how we handle players not being able to pick up items while using
Berserk.
This commit is contained in:
parent
8d22df0411
commit
276800f999
@ -20,6 +20,7 @@ Version 1.4.00-dev
|
|||||||
= Fixed Woodcutting accidentally using Mining double drop values.
|
= Fixed Woodcutting accidentally using Mining double drop values.
|
||||||
= Fixed Hylian Luck not removing the block-placed flag from flowers.
|
= Fixed Hylian Luck not removing the block-placed flag from flowers.
|
||||||
= Fixed Hylian Luck not checking the block-placed flag on flowers.
|
= Fixed Hylian Luck not checking the block-placed flag on flowers.
|
||||||
|
! Changed how Berserk handles not picking up items to avoid listening to PlayerPickupItemEvent
|
||||||
! Moved Hylian Luck into a separate listener since it actually cancels the event and shouldn't just be on MONITOR.
|
! Moved Hylian Luck into a separate listener since it actually cancels the event and shouldn't just be on MONITOR.
|
||||||
! Changed how Tree Feller is handled, it should now put less stress on the CPU
|
! Changed how Tree Feller is handled, it should now put less stress on the CPU
|
||||||
! Changed Fisherman's Diet and Farmer's Diet to use two seperate config values
|
! Changed Fisherman's Diet and Farmer's Diet to use two seperate config values
|
||||||
|
@ -42,6 +42,7 @@ import com.gmail.nossr50.skills.repair.Salvage;
|
|||||||
import com.gmail.nossr50.skills.taming.TamingManager;
|
import com.gmail.nossr50.skills.taming.TamingManager;
|
||||||
import com.gmail.nossr50.util.BlockChecks;
|
import com.gmail.nossr50.util.BlockChecks;
|
||||||
import com.gmail.nossr50.util.Item;
|
import com.gmail.nossr50.util.Item;
|
||||||
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.Users;
|
import com.gmail.nossr50.util.Users;
|
||||||
|
|
||||||
@ -62,28 +63,22 @@ public class PlayerListener implements Listener {
|
|||||||
public void onPlayerWorldChangeEvent(PlayerChangedWorldEvent event) {
|
public void onPlayerWorldChangeEvent(PlayerChangedWorldEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
if (Misc.isNPC(player)) {
|
||||||
|
|
||||||
PlayerProfile profile = Users.getProfile(player);
|
|
||||||
|
|
||||||
if (profile == null) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profile.getGodMode()) {
|
PlayerProfile profile = Users.getProfile(player);
|
||||||
if (!Permissions.mcgod(player)) {
|
|
||||||
|
if (profile.getGodMode() && !Permissions.mcgod(player)) {
|
||||||
profile.toggleGodMode();
|
profile.toggleGodMode();
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.GodMode.Forbidden"));
|
player.sendMessage(LocaleLoader.getString("Commands.GodMode.Forbidden"));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (profile.inParty()) {
|
if (profile.inParty() && !Permissions.party(player)) {
|
||||||
if (!Permissions.party(player)) {
|
|
||||||
profile.removeParty();
|
profile.removeParty();
|
||||||
player.sendMessage(LocaleLoader.getString("Party.Forbidden"));
|
player.sendMessage(LocaleLoader.getString("Party.Forbidden"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Monitor PlayerFish events.
|
* Monitor PlayerFish events.
|
||||||
@ -122,27 +117,6 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Monitor PlaterPickupItem events.
|
|
||||||
*
|
|
||||||
* @param event The event to watch
|
|
||||||
*/
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
|
||||||
public void onPlayerPickupItem(PlayerPickupItemEvent event) {
|
|
||||||
|
|
||||||
if (event.getPlayer().hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
|
||||||
|
|
||||||
PlayerProfile profile = Users.getProfile(event.getPlayer());
|
|
||||||
|
|
||||||
if (profile == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (profile.getAbilityMode(AbilityType.BERSERK)) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Monitor PlayerLogin events.
|
* Monitor PlayerLogin events.
|
||||||
*
|
*
|
||||||
|
@ -178,6 +178,10 @@ public class Skills {
|
|||||||
|
|
||||||
if (ability.getPermissions(player)) {
|
if (ability.getPermissions(player)) {
|
||||||
if (profile.getAbilityMode(ability) && (profile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR) <= curTime) {
|
if (profile.getAbilityMode(ability) && (profile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR) <= curTime) {
|
||||||
|
if (ability == AbilityType.BERSERK) {
|
||||||
|
player.setCanPickupItems(true);
|
||||||
|
}
|
||||||
|
|
||||||
profile.setAbilityMode(ability, false);
|
profile.setAbilityMode(ability, false);
|
||||||
profile.setAbilityInformed(ability, false);
|
profile.setAbilityInformed(ability, false);
|
||||||
player.sendMessage(ability.getAbilityOff());
|
player.sendMessage(ability.getAbilityOff());
|
||||||
@ -442,6 +446,9 @@ public class Skills {
|
|||||||
|
|
||||||
profile.setSkillDATS(ability, System.currentTimeMillis() + (ticks * Misc.TIME_CONVERSION_FACTOR));
|
profile.setSkillDATS(ability, System.currentTimeMillis() + (ticks * Misc.TIME_CONVERSION_FACTOR));
|
||||||
profile.setAbilityMode(ability, true);
|
profile.setAbilityMode(ability, true);
|
||||||
|
if (ability == AbilityType.BERSERK) {
|
||||||
|
player.setCanPickupItems(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user