mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-10-31 21:47:10 +00:00
Merge branch 'development' into shitcan-savedflags
This commit is contained in:
commit
2d18d461fe
20
pom.xml
20
pom.xml
@ -41,8 +41,8 @@
|
||||
<repositories>
|
||||
|
||||
<repository>
|
||||
<id>totalfreedom-development</id>
|
||||
<url>https://atlasmedia.jfrog.io/artifactory/totalfreedom-development/</url>
|
||||
<id>atlas-nexus-01-totalfreedom-development</id>
|
||||
<url>https://nexus-01.core.atlas-media.co.uk/repository/totalfreedom-development/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
@ -133,15 +133,15 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ca.momoperes</groupId>
|
||||
<artifactId>mojangson</artifactId>
|
||||
<version>1.0-20210821.193420-1</version>
|
||||
<groupId>com.github.speedxx</groupId>
|
||||
<artifactId>Mojangson</artifactId>
|
||||
<version>1957eef8d6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bstats</groupId>
|
||||
<artifactId>bstats-bukkit</artifactId>
|
||||
<version>1.8</version>
|
||||
<version>2.2.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
@ -230,10 +230,10 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.AtlasMediaGroup</groupId>
|
||||
<artifactId>TFGuilds</artifactId>
|
||||
<version>master-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
<groupId>me.totalfreedom</groupId>
|
||||
<artifactId>tfguilds</artifactId>
|
||||
<version>2021.06-RC2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -1,40 +1,50 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Eject players that are riding you.", usage = "/<command>")
|
||||
@CommandParameters(description = "Eject any entities that are riding you.", usage = "/<command>")
|
||||
public class Command_eject extends FreedomCommand
|
||||
{
|
||||
/* Player.getShoulderEntityLeft() and Player.getShoulderEntityRight() are deprecated, however unless
|
||||
Player.getPassengers() also includes shoulders (which isn't likely, given the official documentation doesn't
|
||||
state an alternative method to use instead), these methods will continue to be used here. */
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
// Uses the size of the return value of Player.getPassengers() as the starting number of entities ejected
|
||||
int count = playerSender.getPassengers().size();
|
||||
|
||||
List<String> names = new ArrayList<>();
|
||||
|
||||
for (Entity entity : playerSender.getPassengers())
|
||||
// Removes any entities from the sender's shoulders
|
||||
if (playerSender.getShoulderEntityLeft() != null)
|
||||
{
|
||||
names.add(entity.getName());
|
||||
playerSender.setShoulderEntityLeft(null);
|
||||
count++;
|
||||
}
|
||||
if (playerSender.getShoulderEntityRight() != null)
|
||||
{
|
||||
playerSender.setShoulderEntityLeft(null);
|
||||
count++;
|
||||
}
|
||||
|
||||
if (names.isEmpty())
|
||||
// Removes anything riding the sender
|
||||
playerSender.eject();
|
||||
|
||||
if (count != 0)
|
||||
{
|
||||
msg(count + " entit" + (count == 1 ? "y was" : "ies were") + " ejected.", ChatColor.GREEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("Nothing was ejected.", ChatColor.GREEN);
|
||||
return true;
|
||||
}
|
||||
|
||||
msg("Ejecting " + StringUtils.join(names, ", ") + ".", ChatColor.GREEN);
|
||||
playerSender.eject();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,41 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Release parrots from your shoulders.", usage = "/<command>", aliases = "removeparrots")
|
||||
public class Command_releaseparrots extends FreedomCommand
|
||||
{
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
Entity leftShoulderEntity = playerSender.getShoulderEntityLeft();
|
||||
Entity rightShoulderEntity = playerSender.getShoulderEntityRight();
|
||||
|
||||
if (rightShoulderEntity == null && leftShoulderEntity == null)
|
||||
{
|
||||
msg("No parrots were detected on either of your shoulders.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (leftShoulderEntity != null && leftShoulderEntity.getType().equals(EntityType.PARROT))
|
||||
{
|
||||
playerSender.setShoulderEntityLeft(null);
|
||||
msg("Removed the parrot on your left shoulder.");
|
||||
}
|
||||
|
||||
if (rightShoulderEntity != null && rightShoulderEntity.getType().equals(EntityType.PARROT))
|
||||
{
|
||||
playerSender.setShoulderEntityRight(null);
|
||||
msg("Removed the parrot on your right shoulder.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user