mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2026-06-04 18:46:53 +00:00
Squashed commit of the following:
commit35965b0b10Merge:aa20a6e51253732fAuthor: Video <videogamesm12@gmail.com> Date: Mon Nov 29 06:31:11 2021 -0700 Merge pull request #174 from AtlasMediaGroup/FS-256 Forces the server to recalculate the permissions server-wide in /opall (FS-256) commit1253732f77Merge:e1bee321aa20a6e5Author: Video <videogamesm12@gmail.com> Date: Mon Nov 29 06:25:25 2021 -0700 Merge branch 'development' into FS-256 commitaa20a6e579Merge:706229001ecfb0b0Author: Video <videogamesm12@gmail.com> Date: Mon Nov 29 06:23:57 2021 -0700 Merge pull request #129 from AtlasMediaGroup/FS-7 Allow players to pay other players coins [FS-7] commite1bee32163Author: Video <videogamesm12@gmail.com> Date: Mon Nov 29 03:27:07 2021 -0700 Forces the server to recalculate the permissions server-wide in /opall commit1ecfb0b066Merge:225ade8770622900Author: Video <videogamesm12@gmail.com> Date: Mon Nov 29 03:01:22 2021 -0700 Merge branch 'development' into FS-7 commit706229004cMerge:a42cb6afa4adfa9bAuthor: Video <videogamesm12@gmail.com> Date: Mon Nov 29 03:00:15 2021 -0700 Merge pull request #131 from AtlasMediaGroup/FS-273 Moves /rainbowtrail to the shop (FS-273) commita4adfa9beeMerge:1b5bbd1ca42cb6afAuthor: Video <videogamesm12@gmail.com> Date: Mon Nov 29 02:46:41 2021 -0700 Merge branch 'development' into FS-273 commit225ade8753Merge:afe755f5a42cb6afAuthor: Video <videogamesm12@gmail.com> Date: Mon Nov 29 02:46:02 2021 -0700 Merge branch 'development' into FS-7 commita42cb6aff9Merge:2ecfb88601fdf766Author: Video <videogamesm12@gmail.com> Date: Mon Nov 29 02:41:34 2021 -0700 Merge pull request #125 from AtlasMediaGroup/shitcan-savedflags Shitcans SavedFlags commit01fdf766eeMerge:58c21bb12ecfb886Author: Video <videogamesm12@gmail.com> Date: Tue Nov 23 09:28:48 2021 -0700 Merge branch 'development' into shitcan-savedflags commitafe755f5c1Merge:5f97e68e2ecfb886Author: Video <videogamesm12@gmail.com> Date: Tue Nov 23 09:26:59 2021 -0700 Merge branch 'development' into FS-7 commit5f97e68e0eAuthor: Video <videogamesm12@gmail.com> Date: Tue Nov 23 09:26:49 2021 -0700 fuck it, it works commit1b5bbd1c05Merge:8356e8312ecfb886Author: Video <videogamesm12@gmail.com> Date: Tue Nov 23 09:16:21 2021 -0700 Merge branch 'development' into FS-273 commit2ecfb88604Merge:42143c11bb2ddf11Author: Video <videogamesm12@gmail.com> Date: Tue Nov 23 09:15:16 2021 -0700 Merge pull request #130 from AtlasMediaGroup/FS-215 Makes [Discord] a hyperlink (FS-215) commit8356e831a5Author: Video <videogamesm12@gmail.com> Date: Tue Nov 23 09:11:16 2021 -0700 Redundancy fix and better protection system commitab00cb840fMerge:ecce62f642143c11Author: Video <videogamesm12@gmail.com> Date: Tue Nov 23 03:31:45 2021 -0700 Merge branch 'development' into FS-273 commitbb2ddf1129Merge:cf9fdc6f42143c11Author: Video <videogamesm12@gmail.com> Date: Tue Nov 23 03:31:19 2021 -0700 Merge branch 'development' into FS-215 commit58c21bb1aaMerge:fdba119d42143c11Author: Video <videogamesm12@gmail.com> Date: Tue Nov 23 03:30:48 2021 -0700 Merge branch 'development' into shitcan-savedflags commitecce62f6b4Merge:d8148530a598c933Author: Video <videogamesm12@gmail.com> Date: Sat Oct 9 00:01:22 2021 -0600 Merge branch 'development' into FS-273 commitcf9fdc6fe4Merge:387ea6f7a598c933Author: Video <videogamesm12@gmail.com> Date: Fri Oct 8 01:43:33 2021 -0600 Merge branch 'development' into FS-215 commit387ea6f71eMerge:a1ecf881180cd811Author: Video <videogamesm12@gmail.com> Date: Fri Oct 1 00:35:12 2021 -0600 Merge branch 'development' into FS-215 commitd814853036Merge:47e63869213a4338Author: Ryan <Wild1145@users.noreply.github.com> Date: Sun Sep 12 13:49:05 2021 +0100 Merge branch 'development' into FS-273 commita1ecf88109Merge:bd647afe213a4338Author: Ryan <Wild1145@users.noreply.github.com> Date: Sun Sep 12 13:48:59 2021 +0100 Merge branch 'development' into FS-215 commit5a6a5ff75dMerge:6ca61d9c213a4338Author: Ryan <Wild1145@users.noreply.github.com> Date: Sun Sep 12 13:48:50 2021 +0100 Merge branch 'development' into FS-7 commitfdba119d5dMerge:61857dd0213a4338Author: Ryan <Wild1145@users.noreply.github.com> Date: Sun Sep 12 13:48:44 2021 +0100 Merge branch 'development' into shitcan-savedflags commit61857dd06fMerge:2d18d4610e12f5e7Author: Video <videogamesm12@gmail.com> Date: Sun Sep 12 03:01:37 2021 -0600 Merge branch 'development' into shitcan-savedflags commitbd647afe92Merge:69f17ef20e12f5e7Author: Video <videogamesm12@gmail.com> Date: Sun Sep 12 02:50:39 2021 -0600 Merge branch 'development' into FS-215 commit69f17ef2d7Merge:ee1b27faaebe1aceAuthor: Video <videogamesm12@gmail.com> Date: Sun Sep 12 02:01:56 2021 -0600 Merge branch 'development' into FS-215 commitee1b27fa0dMerge:2bdf14f30a9b95bfAuthor: Ryan <Wild1145@users.noreply.github.com> Date: Sat Sep 11 01:24:00 2021 +0100 Merge branch 'development' into FS-215 commit6ca61d9c6cMerge:fedf80b80a9b95bfAuthor: Ryan <Wild1145@users.noreply.github.com> Date: Sat Sep 11 01:23:52 2021 +0100 Merge branch 'development' into FS-7 commit2d18d461feMerge:a4c81f200a9b95bfAuthor: Ryan <Wild1145@users.noreply.github.com> Date: Sat Sep 11 01:23:44 2021 +0100 Merge branch 'development' into shitcan-savedflags commit47e6386907Merge:b1062fbb0a9b95bfAuthor: Ryan <Wild1145@users.noreply.github.com> Date: Sat Sep 11 01:23:13 2021 +0100 Merge branch 'development' into FS-273 commitfedf80b834Merge:a2d11d4b44ff621dAuthor: Video <videogamesm12@gmail.com> Date: Fri Sep 10 01:39:16 2021 -0600 Merge branch 'development' into FS-7 commit2bdf14f38cMerge:f6d46b6144ff621dAuthor: Video <videogamesm12@gmail.com> Date: Mon Sep 6 15:26:13 2021 -0600 Merge branch 'development' into FS-215 commitb1062fbb6cMerge:f69feed444ff621dAuthor: Video <videogamesm12@gmail.com> Date: Mon Sep 6 14:39:32 2021 -0600 Merge branch 'development' into FS-273 commitf69feed469Author: Video <videogamesm12@gmail.com> Date: Mon Sep 6 01:14:21 2021 -0600 fixed commit8253f94ac4Merge:daf0126f54cb0cfaAuthor: Video <videogamesm12@gmail.com> Date: Mon Sep 6 01:12:00 2021 -0600 Merge branch 'development' into FS-273 commita4c81f202cMerge:0d09c3a523caa4e8Author: Ryan <Wild1145@users.noreply.github.com> Date: Sat Sep 4 01:23:06 2021 +0100 Merge branch 'development' into shitcan-savedflags commitdaf0126f45Merge:a51f5c9b23caa4e8Author: Ryan <Wild1145@users.noreply.github.com> Date: Sat Sep 4 01:07:39 2021 +0100 Merge branch 'development' into FS-273 commitf6d46b6178Merge:ee804d5223caa4e8Author: Ryan <Wild1145@users.noreply.github.com> Date: Sat Sep 4 01:07:33 2021 +0100 Merge branch 'development' into FS-215 commita2d11d4b93Merge:dc49065923caa4e8Author: Ryan <Wild1145@users.noreply.github.com> Date: Sat Sep 4 01:07:28 2021 +0100 Merge branch 'development' into FS-7 commita51f5c9bbfAuthor: Video <videogamesm12@gmail.com> Date: Fri Sep 3 13:53:33 2021 -0600 FS-273 commitee804d52ffAuthor: Video <videogamesm12@gmail.com> Date: Fri Sep 3 12:52:15 2021 -0600 Makes [Discord] a hyperlink (FS-215) I've decided to overhaul the implementation of DiscordToMinecraftListener to make it more easily workable. This overhaul allows me to implement FS-215 more easily. commitdc490659c1Author: Video <videogamesm12@gmail.com> Date: Fri Sep 3 00:07:20 2021 -0600 Begins implementing FS-7 should be good enough, but feedback would be lovely commit0d09c3a550Merge:e2ccd14e4c3f188bAuthor: Ryan <Wild1145@users.noreply.github.com> Date: Sun Aug 29 20:09:03 2021 +0100 Merge branch 'development' into shitcan-savedflags commite2ccd14eb3Author: Video <videogamesm12@gmail.com> Date: Fri Aug 27 16:54:55 2021 -0600 Unsaves SavedFlags
This commit is contained in:
@@ -9,8 +9,11 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Shows the amount of coins you have or another player has", usage = "/<command> [playername]")
|
||||
@CommandParameters(description = "Shows the amount of coins you or another player has. Also allows you to give coins to other players.", usage = "/<command> [player] | pay <player> <amount>")
|
||||
public class Command_coins extends FreedomCommand
|
||||
{
|
||||
@Override
|
||||
@@ -21,34 +24,119 @@ public class Command_coins extends FreedomCommand
|
||||
msg("The shop is currently disabled!", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
Player p;
|
||||
|
||||
final String prefix = FUtil.colorize(ConfigEntry.SHOP_PREFIX.getString() + " ");
|
||||
if (args.length > 0)
|
||||
|
||||
switch (args.length)
|
||||
{
|
||||
if (getPlayer(args[0]) != null)
|
||||
// Mode for seeing how many coins the sender has (doesn't work from console)
|
||||
case 0:
|
||||
{
|
||||
p = getPlayer(args[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg(PLAYER_NOT_FOUND);
|
||||
if (senderIsConsole)
|
||||
{
|
||||
msg("When used from the console, you must define a target player.");
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerData playerData = getData(playerSender);
|
||||
msg(prefix + ChatColor.GREEN + "You have " + ChatColor.RED + playerData.getCoins() + ChatColor.GREEN
|
||||
+ " coins.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (senderIsConsole)
|
||||
|
||||
// Mode for seeing how many coins a player has.
|
||||
case 1:
|
||||
{
|
||||
msg(prefix + ChatColor.RED + "You are not a player, use /coins <playername>");
|
||||
Player target = getPlayer(args[0]);
|
||||
|
||||
if (target == null)
|
||||
{
|
||||
msg(PLAYER_NOT_FOUND);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerData playerData = getData(target);
|
||||
msg(prefix + ChatColor.GREEN + target.getName() + " has " + ChatColor.RED + playerData.getCoins() + ChatColor.GREEN + " coins.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
// Mode for paying another player coins
|
||||
case 3:
|
||||
{
|
||||
p = playerSender;
|
||||
if (args[0].equalsIgnoreCase("pay"))
|
||||
{
|
||||
checkPlayer();
|
||||
|
||||
final Player target = getPlayer(args[1]);
|
||||
final PlayerData senderData = getData(playerSender);
|
||||
|
||||
int coinsToTransfer;
|
||||
|
||||
// Processes args[2]
|
||||
try
|
||||
{
|
||||
// Prevents players from trying to be cheeky with negative numbers.
|
||||
coinsToTransfer = Math.max(Math.abs(Integer.parseInt(args[2])), 1);
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
msg("Invalid number: " + args[2], ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Prevents players from performing transactions they can't afford to do.
|
||||
if (senderData.getCoins() < coinsToTransfer)
|
||||
{
|
||||
msg("You don't have enough coins to perform this transaction.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (target == null)
|
||||
{
|
||||
msg(PLAYER_NOT_FOUND);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerData playerData = getData(target);
|
||||
playerData.setCoins(playerData.getCoins() + coinsToTransfer);
|
||||
senderData.setCoins(senderData.getCoins() - coinsToTransfer);
|
||||
|
||||
msg(target, sender.getName()
|
||||
+ ChatColor.GREEN + " has given you "
|
||||
+ ChatColor.GOLD + coinsToTransfer
|
||||
+ ChatColor.GREEN + " coin" + (coinsToTransfer > 1 ? "s" : "") + "!", ChatColor.GOLD);
|
||||
|
||||
msg("You have given "
|
||||
+ ChatColor.GOLD + coinsToTransfer
|
||||
+ ChatColor.GREEN + " coin" + (coinsToTransfer > 1 ? "s" : "")
|
||||
+ " to " + ChatColor.GOLD + target.getName() + ChatColor.GREEN + ".", ChatColor.GREEN);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
PlayerData playerData = plugin.pl.getData(p);
|
||||
msg(prefix + ChatColor.GREEN + (args.length > 0 ? p.getName() + " has " : "You have ") + ChatColor.RED + playerData.getCoins() + ChatColor.GREEN + " coins.");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
|
||||
{
|
||||
if (args.length == 1)
|
||||
{
|
||||
List<String> options = new ArrayList<>(FUtil.getPlayerList());
|
||||
|
||||
options.add("pay");
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
return FUtil.getPlayerList();
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,10 @@ public class Command_opall extends FreedomCommand
|
||||
msg(player, YOU_ARE_OP);
|
||||
plugin.rm.updateDisplay(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.recalculatePermissions();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user