mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
it won't stop erroring
this wouldn't be good for the server, so for now, it's removed. i will work on it again soon, though.
This commit is contained in:
parent
c096c4a781
commit
d7e3f05010
@ -188,6 +188,7 @@ public class LoginProcess extends FreedomService
|
||||
{
|
||||
final Player player = event.getPlayer();
|
||||
final FPlayer fPlayer = plugin.pl.getPlayer(player);
|
||||
final VPlayer verificationPlayer = plugin.pv.getVerificationPlayer(player);
|
||||
|
||||
player.sendTitle(ChatColor.GRAY + "Welcome to " + ChatColor.YELLOW + "TotalFreedom!", ChatColor.GREEN + "Celebrating 9 years!", 20, 100, 60);
|
||||
player.setOp(true);
|
||||
|
@ -1,55 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigInventory;
|
||||
import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "View inventory information of players.", usage = "/<command> <player> <slot>", aliases = "il,invlookup")
|
||||
public class Command_inventorylookup extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
VPlayer vPlayer = plugin.pv.getVerificationPlayer(args[0]);
|
||||
if (vPlayer == null)
|
||||
{
|
||||
msg("Could not find player or find that player's data.");
|
||||
return true;
|
||||
}
|
||||
ConfigInventory inv = vPlayer.getInventory();
|
||||
int slot;
|
||||
try
|
||||
{
|
||||
slot = Integer.valueOf(args[1]);
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
msg("That is not a valid number.");
|
||||
return true;
|
||||
}
|
||||
ItemStack stack = inv.get(slot);
|
||||
if (stack == null)
|
||||
{
|
||||
stack = new ItemStack(Material.AIR, 1);
|
||||
}
|
||||
msg(args[0] + "'s Inventory - Slot " + slot + ":");
|
||||
msg(" - Material: " + stack.getType().name());
|
||||
msg(" - Amount: " + stack.getAmount());
|
||||
if (inv.hasNBT(slot))
|
||||
{
|
||||
msg(" - NBT Data: " + inv.getNBT(slot).toString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,101 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod.config;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.minecraft.server.v1_14_R1.NBTTagCompound;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class ConfigInventory
|
||||
{
|
||||
@Getter
|
||||
@Setter
|
||||
private Map<Integer, ItemStack> inventoryItems;
|
||||
|
||||
public ConfigInventory(Inventory inv)
|
||||
{
|
||||
updateInventory(inv);
|
||||
}
|
||||
|
||||
public void set(int location, Material material, int amount, NBTTagCompound nbt)
|
||||
{
|
||||
ItemStack stack = new ItemStack(material, amount);
|
||||
/*
|
||||
net.minecraft.server.v1_14_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(stack);
|
||||
nmsStack.setTag(nbt);
|
||||
stack = CraftItemStack.asBukkitCopy(nmsStack);
|
||||
*/
|
||||
inventoryItems.put(location, stack);
|
||||
}
|
||||
|
||||
public void set(int location, ItemStack stack)
|
||||
{
|
||||
inventoryItems.put(location, stack);
|
||||
}
|
||||
|
||||
public ItemStack get(int location)
|
||||
{
|
||||
return inventoryItems.get(location);
|
||||
}
|
||||
|
||||
public boolean hasNBT(int location)
|
||||
{
|
||||
return CraftItemStack.asNMSCopy(inventoryItems.get(location)).hasTag();
|
||||
}
|
||||
|
||||
public NBTTagCompound getNBT(int location)
|
||||
{
|
||||
return CraftItemStack.asNMSCopy(inventoryItems.get(location)).getTag();
|
||||
}
|
||||
|
||||
public void updateInventory(Inventory inv)
|
||||
{
|
||||
inventoryItems = new HashMap<>();
|
||||
if (inv == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < inv.getSize(); i++)
|
||||
{
|
||||
inventoryItems.put(i, inv.getItem(i));
|
||||
}
|
||||
}
|
||||
|
||||
public void save(ConfigurationSection cs)
|
||||
{
|
||||
for (int i = 0; i < inventoryItems.size(); i++)
|
||||
{
|
||||
ItemStack currentStack = inventoryItems.get(i);
|
||||
net.minecraft.server.v1_14_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(currentStack);
|
||||
if (currentStack == null)
|
||||
{
|
||||
ItemStack air = new ItemStack(Material.AIR, 1);
|
||||
inventoryItems.put(i, air);
|
||||
currentStack = air;
|
||||
}
|
||||
cs.set("inventory." + i + ".type", currentStack.getType().name());
|
||||
cs.set("inventory." + i + ".amount", currentStack.getAmount());
|
||||
if (nmsStack.hasTag())
|
||||
{
|
||||
cs.set("inventory." + i + ".nbt", nmsStack.getTag().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ConfigInventory createInventoryFromConfig(ConfigurationSection cs)
|
||||
{
|
||||
ConfigInventory configInventory = new ConfigInventory(null);
|
||||
for (int i = 0; i < 40; i++)
|
||||
{
|
||||
configInventory.set(i, Material.valueOf(cs.getString("inventory." + i + ".type")),
|
||||
cs.getInt("inventory." + i + ".amount"), null);//,
|
||||
//(NBTTagCompound) cs.get("inventory." + i + ".nbt"));
|
||||
}
|
||||
return configInventory;
|
||||
}
|
||||
}
|
@ -5,12 +5,10 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigInventory;
|
||||
import net.pravian.aero.base.ConfigLoadable;
|
||||
import net.pravian.aero.base.ConfigSavable;
|
||||
import net.pravian.aero.base.Validatable;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -39,9 +37,6 @@ public class VPlayer implements ConfigLoadable, ConfigSavable, Validatable
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean rideToggle = true;
|
||||
@Getter
|
||||
@Setter
|
||||
private ConfigInventory inventory = null;
|
||||
|
||||
public VPlayer(String name)
|
||||
{
|
||||
@ -64,14 +59,6 @@ public class VPlayer implements ConfigLoadable, ConfigSavable, Validatable
|
||||
tag = cs.getString("tag", null);
|
||||
clearChatOptOut = cs.getBoolean("clearChatOptOut", false);
|
||||
rideToggle = cs.getBoolean("rideToggle", true);
|
||||
if (!cs.contains("inventory") || Bukkit.getPlayer(name) != null)
|
||||
{
|
||||
inventory = new ConfigInventory(Bukkit.getPlayer(name).getInventory());
|
||||
}
|
||||
else
|
||||
{
|
||||
inventory = ConfigInventory.createInventoryFromConfig(cs);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -85,8 +72,6 @@ public class VPlayer implements ConfigLoadable, ConfigSavable, Validatable
|
||||
cs.set("ips", Lists.newArrayList(ips));
|
||||
cs.set("clearChatOptOut", clearChatOptOut);
|
||||
cs.set("rideToggle", rideToggle);
|
||||
inventory.updateInventory(Bukkit.getPlayer(name).getInventory());
|
||||
inventory.save(cs);
|
||||
}
|
||||
|
||||
public List<String> getIps()
|
||||
|
Loading…
Reference in New Issue
Block a user