Compare commits

...

3 Commits

Author SHA1 Message Date
Robert Alan Chapton
bea283e56c
Update README.md
tweak the readme
2025-04-13 12:15:43 -07:00
nossr50
13a329d4ae update changelog 2025-04-13 12:04:25 -07:00
nossr50
65d4d2b059 Chimaera wing code is a little bit less disgusting now Fixes #5049 2025-04-13 12:03:52 -07:00
4 changed files with 79 additions and 70 deletions

View File

@ -1,3 +1,6 @@
Version 2.2.036
Fixed a bug where Chimaera Wing could cause an exception when used
Version 2.2.035
Support for new additions from Minecraft 1.21.5
Fixed bug where Blast Mining would not drop deep slate

View File

@ -1,14 +1,14 @@
# mcMMO
## The #1 RPG Mod for Minecraft
The #1 RPG Mod for Minecraft
## Website
I'm working on a brand new website for mcMMO
You can check it out here http://www.mcmmo.org
## Useful URLs
Website: http://www.mcmmo.org
Spigot Resource: https://spigot.mcmmo.org
I plan to post links to our new wiki (its still under development), downloads, and dev blogs there.
Polymart Resource: https://polymart.org/product/727/mcmmo
Wiki: https://wiki.mcmmo.org/
## API
If you are using maven, you can add mcMMO API to your plugin by adding it to pom.xml like so...
@ -27,8 +27,7 @@ If you are using maven, you can add mcMMO API to your plugin by adding it to pom
</dependency>
```
### Builds
Currently, you can obtain our builds via the Spigot or Polymart:
Currently, you can obtain our builds via Spigot or Polymart:
http://spigot.mcmmo.org
@ -39,8 +38,6 @@ The goal of mcMMO is to take core Minecraft game mechanics and expand them into
## About the Team
In December 2018, the original author and creator of mcMMO (nossr50) returned and took over the role of project lead once again, to develop and improve mcMMO.
#### Project Lead & Founder
[![nossr50](http://www.gravatar.com/avatar/f2ee41eedfd645fb4a3a2c8f6cb1b18c.png)](https://github.com/nossr50)
#### Current mcMMO Devs
[![nossr50](http://www.gravatar.com/avatar/f2ee41eedfd645fb4a3a2c8f6cb1b18c.png)](https://github.com/nossr50)
@ -72,8 +69,7 @@ The typical command used to build mcMMO is: `mvn clean install`
https://spigot.mcmmo.org for more up to date information.
Downloads:
## Downloads
https://www.spigotmc.org/resources/official-mcmmo-original-author-returns.64348/

View File

@ -1,5 +1,6 @@
package com.gmail.nossr50.runnables.items;
import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
@ -7,16 +8,24 @@ import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.ChimaeraWing;
import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.player.NotificationManager;
import com.gmail.nossr50.util.skills.SkillUtils;
import com.gmail.nossr50.util.sounds.SoundManager;
import com.gmail.nossr50.util.sounds.SoundType;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class ChimaeraWingWarmup extends CancellableRunnable {
private final McMMOPlayer mcMMOPlayer;
import static com.gmail.nossr50.util.ChimaeraWing.expendChimaeraWing;
public ChimaeraWingWarmup(McMMOPlayer mcMMOPlayer) {
this.mcMMOPlayer = mcMMOPlayer;
public class ChimaeraWingWarmup extends CancellableRunnable {
private final McMMOPlayer mmoPlayer;
private final Location location;
public ChimaeraWingWarmup(McMMOPlayer mmoPlayer, Location location) {
this.mmoPlayer = mmoPlayer;
this.location = location;
}
@Override
@ -25,23 +34,24 @@ public class ChimaeraWingWarmup extends CancellableRunnable {
}
private void checkChimaeraWingTeleport() {
Player player = mcMMOPlayer.getPlayer();
Location previousLocation = mcMMOPlayer.getTeleportCommenceLocation();
final Player player = mmoPlayer.getPlayer();
final Location previousLocation = mmoPlayer.getTeleportCommenceLocation();
if (player.getLocation().distanceSquared(previousLocation) > 1.0 || !player.getInventory().containsAtLeast(ChimaeraWing.getChimaeraWing(0), 1)) {
if (player.getLocation().distanceSquared(previousLocation) > 1.0
|| !player.getInventory().containsAtLeast(ChimaeraWing.getChimaeraWing(1), 1)) {
player.sendMessage(LocaleLoader.getString("Teleport.Cancelled"));
mcMMOPlayer.setTeleportCommenceLocation(null);
mmoPlayer.setTeleportCommenceLocation(null);
return;
}
ItemStack inHand = player.getInventory().getItemInMainHand();
final ItemStack inHand = player.getInventory().getItemInMainHand();
if (!ItemUtils.isChimaeraWing(inHand) || inHand.getAmount() < mcMMO.p.getGeneralConfig().getChimaeraUseCost()) {
player.sendMessage(LocaleLoader.getString("Skills.NeedMore", LocaleLoader.getString("Item.ChimaeraWing.Name")));
return;
}
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
long recentlyHurt = mmoPlayer.getRecentlyHurt();
int hurtCooldown = mcMMO.p.getGeneralConfig().getChimaeraRecentlyHurtCooldown();
if (hurtCooldown > 0) {
@ -53,6 +63,32 @@ public class ChimaeraWingWarmup extends CancellableRunnable {
}
}
ChimaeraWing.chimaeraExecuteTeleport();
chimaeraExecuteTeleport();
}
private void chimaeraExecuteTeleport() {
final Player player = mmoPlayer.getPlayer();
if (mcMMO.p.getGeneralConfig().getChimaeraUseBedSpawn() && player.getBedSpawnLocation() != null) {
mcMMO.p.getFoliaLib().getScheduler().teleportAsync(player, player.getBedSpawnLocation());
} else {
final Location spawnLocation = player.getWorld().getSpawnLocation();
if (spawnLocation.getBlock().getType() == Material.AIR) {
mcMMO.p.getFoliaLib().getScheduler().teleportAsync(player, spawnLocation);
} else {
mcMMO.p.getFoliaLib().getScheduler().teleportAsync(
player, player.getWorld().getHighestBlockAt(spawnLocation).getLocation());
}
}
expendChimaeraWing(player, mcMMO.p.getGeneralConfig().getChimaeraUseCost(), player.getInventory().getItemInMainHand());
mmoPlayer.actualizeChimeraWingLastUse();
mmoPlayer.setTeleportCommenceLocation(null);
if (mcMMO.p.getGeneralConfig().getChimaeraSoundEnabled()) {
SoundManager.sendSound(player, location, SoundType.CHIMAERA_WING);
}
NotificationManager.sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Item.ChimaeraWing.Pass");
}
}

View File

@ -9,8 +9,6 @@ import com.gmail.nossr50.util.player.NotificationManager;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
import com.gmail.nossr50.util.sounds.SoundManager;
import com.gmail.nossr50.util.sounds.SoundType;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
@ -25,9 +23,6 @@ import java.util.ArrayList;
import java.util.List;
public final class ChimaeraWing {
private static McMMOPlayer mcMMOPlayer;
private static Location location;
private ChimaeraWing() {}
/**
@ -40,7 +35,7 @@ public final class ChimaeraWing {
return;
}
ItemStack inHand = player.getInventory().getItemInMainHand();
final ItemStack inHand = player.getInventory().getItemInMainHand();
if (!ItemUtils.isChimaeraWing(inHand)) {
return;
@ -51,7 +46,7 @@ public final class ChimaeraWing {
return;
}
mcMMOPlayer = UserManager.getPlayer(player);
final McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
//Not loaded
if (mcMMOPlayer == null)
@ -61,10 +56,10 @@ public final class ChimaeraWing {
return;
}
int amount = inHand.getAmount();
int amountInHand = inHand.getAmount();
if (amount < mcMMO.p.getGeneralConfig().getChimaeraUseCost()) {
NotificationManager.sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Item.ChimaeraWing.NotEnough",String.valueOf(mcMMO.p.getGeneralConfig().getChimaeraUseCost() - amount), "Item.ChimaeraWing.Name");
if (amountInHand < mcMMO.p.getGeneralConfig().getChimaeraUseCost()) {
NotificationManager.sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Item.ChimaeraWing.NotEnough",String.valueOf(mcMMO.p.getGeneralConfig().getChimaeraUseCost() - amountInHand), "Item.ChimaeraWing.Name");
return;
}
@ -92,13 +87,13 @@ public final class ChimaeraWing {
}
}
location = player.getLocation();
final Location playerLocation = player.getLocation();
if (mcMMO.p.getGeneralConfig().getChimaeraPreventUseUnderground()) {
if (location.getY() < player.getWorld().getHighestBlockYAt(location)) {
player.getInventory().setItemInMainHand(new ItemStack(getChimaeraWing(amount - mcMMO.p.getGeneralConfig().getChimaeraUseCost())));
NotificationManager.sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Item.ChimaeraWing.Fail");
player.updateInventory();
if (playerLocation.getY() < player.getWorld().getHighestBlockYAt(playerLocation)) {
expendChimaeraWing(player, amountInHand, inHand);
NotificationManager.sendPlayerInformation(player,
NotificationType.REQUIREMENTS_NOT_MET, "Item.ChimaeraWing.Fail");
player.setVelocity(new Vector(0, 0.5D, 0));
CombatUtils.dealDamage(player, Misc.getRandom().nextInt((int) (player.getHealth() - 10)));
mcMMOPlayer.actualizeChimeraWingLastUse();
@ -107,44 +102,23 @@ public final class ChimaeraWing {
}
mcMMOPlayer.actualizeTeleportCommenceLocation(player);
long warmup = mcMMO.p.getGeneralConfig().getChimaeraWarmup();
if (warmup > 0) {
NotificationManager.sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Teleport.Commencing", String.valueOf(warmup));
mcMMO.p.getFoliaLib().getScheduler().runAtEntityLater(player, new ChimaeraWingWarmup(mcMMOPlayer), 20 * warmup);
long teleportDelay = mcMMO.p.getGeneralConfig().getChimaeraWarmup();
if (teleportDelay > 0) {
NotificationManager.sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Teleport.Commencing", String.valueOf(teleportDelay));
mcMMO.p.getFoliaLib().getScheduler().runAtEntityLater(player, new ChimaeraWingWarmup(mcMMOPlayer, playerLocation), 20 * teleportDelay);
} else {
chimaeraExecuteTeleport();
mcMMO.p.getFoliaLib().getScheduler().runAtEntityLater(player, new ChimaeraWingWarmup(mcMMOPlayer, playerLocation), 0);
}
}
public static void chimaeraExecuteTeleport() {
Player player = mcMMOPlayer.getPlayer();
if (mcMMO.p.getGeneralConfig().getChimaeraUseBedSpawn() && player.getBedSpawnLocation() != null) {
// player.teleport(player.getBedSpawnLocation());
mcMMO.p.getFoliaLib().getScheduler().teleportAsync(player, player.getBedSpawnLocation());
public static void expendChimaeraWing(Player player, int amountInHand, ItemStack inHand) {
int amountAfterUse = amountInHand - mcMMO.p.getGeneralConfig().getChimaeraUseCost();
if (amountAfterUse >= 1) {
inHand.setAmount(amountAfterUse);
player.getInventory().setItemInMainHand(inHand);
} else {
Location spawnLocation = player.getWorld().getSpawnLocation();
if (spawnLocation.getBlock().getType() == Material.AIR) {
// player.teleport(spawnLocation);
mcMMO.p.getFoliaLib().getScheduler().teleportAsync(player, spawnLocation);
} else {
// player.teleport(player.getWorld().getHighestBlockAt(spawnLocation).getLocation());
mcMMO.p.getFoliaLib().getScheduler().teleportAsync(player, player.getWorld().getHighestBlockAt(spawnLocation).getLocation());
}
player.getInventory().removeItem(inHand);
}
player.getInventory().setItemInMainHand(new ItemStack(getChimaeraWing(player.getInventory().getItemInMainHand().getAmount() - mcMMO.p.getGeneralConfig().getChimaeraUseCost())));
player.updateInventory();
mcMMOPlayer.actualizeChimeraWingLastUse();
mcMMOPlayer.setTeleportCommenceLocation(null);
if (mcMMO.p.getGeneralConfig().getChimaeraSoundEnabled()) {
SoundManager.sendSound(player, location, SoundType.CHIMAERA_WING);
}
NotificationManager.sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Item.ChimaeraWing.Pass");
}
public static ItemStack getChimaeraWing(int amount) {