lotta commands

This commit is contained in:
ZeroEpoch1969 2018-07-21 17:45:56 -07:00
parent 301c5b8da1
commit e8eda42295
No known key found for this signature in database
GPG Key ID: E0AAB104FB9F8FDF
8 changed files with 271 additions and 0 deletions

View File

@ -95,6 +95,7 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
public ServerPing sp; public ServerPing sp;
public ItemFun it; public ItemFun it;
public Landminer lm; public Landminer lm;
public MobStacker ms;
public MP44 mp; public MP44 mp;
public Jumppads jp; public Jumppads jp;
public Trailer tr; public Trailer tr;
@ -210,6 +211,7 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
// Fun // Fun
it = services.registerService(ItemFun.class); it = services.registerService(ItemFun.class);
lm = services.registerService(Landminer.class); lm = services.registerService(Landminer.class);
ms = services.registerService(MobStacker.class);
mp = services.registerService(MP44.class); mp = services.registerService(MP44.class);
jp = services.registerService(Jumppads.class); jp = services.registerService(Jumppads.class);
tr = services.registerService(Trailer.class); tr = services.registerService(Trailer.class);

View File

@ -0,0 +1,35 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.apache.commons.lang3.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;
import java.util.ArrayList;
import java.util.List;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Eject everything off of you.", usage = "/<command>")
public class Command_eject extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
List<String> names = new ArrayList();
for (Entity entity : playerSender.getPassengers())
{
names.add(entity.getName());
}
msg("Ejecting " + StringUtils.join(names, ", ") + ".", ChatColor.GREEN);
playerSender.eject();
return true;
}
}

View File

@ -0,0 +1,21 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Make other people your bitch.", usage = "/<command>")
public class Command_gravity extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
playerSender.setGravity(!playerSender.hasGravity());
msg((playerSender.hasGravity() ? "En" : "Dis") + "abled gravity.", (playerSender.hasGravity() ? ChatColor.GREEN : ChatColor.RED));
return true;
}
}

View File

@ -0,0 +1,34 @@
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
{
@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 (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;
}
}

View File

@ -0,0 +1,40 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Make other people your bitch.", usage = "/<command> <playername>")
public class Command_ride extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length < 1)
{
return false;
}
final Player player = getPlayer(args[0]);
if (player == null)
{
msg(PLAYER_NOT_FOUND);
return true;
}
if (player == playerSender)
{
msg("You can't ride yourself. smh.", ChatColor.RED);
return true;
}
player.addPassenger(playerSender);
return true;
}
}

View File

@ -0,0 +1,37 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Set your compass to a position.", usage = "/<command> <x> <y> <z>")
public class Command_setcompass extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length < 3)
{
return false;
}
try
{
Location location = new Location(playerSender.getWorld(), Integer.valueOf(args[0]), Integer.valueOf(args[1]), Integer.valueOf(args[2]));
playerSender.setCompassTarget(location);
msg("Successfully set your compass coordinates to X: " + args[0] + ", Y: " + args[1] + ", Z: " + args[2] + ".", ChatColor.GREEN);
}
catch (NumberFormatException e)
{
msg("One or more of your coordinates are not a valid integer.", ChatColor.RED);
}
return true;
}
}

View File

@ -0,0 +1,46 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Quickly spectate someone.", usage = "/<command> <playername>", aliases="spec")
public class Command_spectate extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length == 0)
{
return false;
}
Player player = getPlayer(args[0]);
if (player == null)
{
msg(PLAYER_NOT_FOUND);
return true;
}
if (player.getGameMode().equals(GameMode.SPECTATOR))
{
msg("You cannot spectate other players that are in spectator mode.", ChatColor.RED);
return true;
}
if (!playerSender.getGameMode().equals(GameMode.SPECTATOR))
{
playerSender.setGameMode(GameMode.SPECTATOR);
}
playerSender.setSpectatorTarget(player);
return true;
}
}

View File

@ -0,0 +1,56 @@
package me.totalfreedom.totalfreedommod.fun;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class MobStacker extends FreedomService
{
public MobStacker(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
{
}
@Override
protected void onStop()
{
}
@EventHandler(priority = EventPriority.MONITOR)
public void onEntityDamage(EntityDamageByEntityEvent event)
{
if (event.getEntity() instanceof Player || !(event.getDamager() instanceof Player))
{
return;
}
Player attacker = (Player)event.getDamager();
if (!plugin.al.isSeniorAdmin(attacker))
{
return;
}
ItemStack item = attacker.getInventory().getItemInMainHand();
if (item != null && item.getType().equals(Material.POTATO_ITEM))
{
event.setCancelled(true);
attacker.addPassenger(event.getEntity());
}
}
}