mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-18 22:49:45 +00:00

Many commands have been cleaned. File changes: - all user data has been moved from users.yml to userdata folder - all files in userdata folder are lower case Both changes should be done automatically. Class changes: - Moved all user data functions to UserData class - Moved all user teleport functions to Teleport class - Moved the user list to Essentials class - Less static functions for better testing - EssentialsCommand now has ess Property (Essentials class) - New NotEnoughArgumentsException, that will show command description and syntax New commands: - /seen, shows the last login or logout - /tempban, temporarily ban someone - /tjail and mute, temporarily option added Other changes: - ban reason is saved - don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission - time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
96 lines
1.8 KiB
Java
96 lines
1.8 KiB
Java
package com.earth2me.essentials;
|
|
|
|
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
|
import net.minecraft.server.EntityPlayer;
|
|
import net.minecraft.server.IInventory;
|
|
import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer;
|
|
import org.bukkit.entity.*;
|
|
|
|
|
|
public class PlayerExtension extends PlayerWrapper
|
|
{
|
|
public PlayerExtension(Player base)
|
|
{
|
|
super(base);
|
|
}
|
|
|
|
public boolean isBanned()
|
|
{
|
|
return Essentials.getStatic().bans.contains(getName());
|
|
}
|
|
|
|
public boolean isIpBanned()
|
|
{
|
|
return Essentials.getStatic().bannedIps.contains(getAddress().getAddress().toString().replace("/", ""));
|
|
}
|
|
|
|
public float getCorrectedYaw()
|
|
{
|
|
float angle = (getLocation().getYaw() - 90.0f) % 360.0f;
|
|
if (angle < 0) {
|
|
angle += 360.0f;
|
|
}
|
|
return angle;
|
|
}
|
|
|
|
public void showInventory(IInventory inventory)
|
|
{
|
|
getHandle().a(inventory);
|
|
}
|
|
|
|
public void showInventory(CraftInventoryPlayer inventory)
|
|
{
|
|
showInventory((IInventory)inventory.getInventory());
|
|
}
|
|
|
|
public TargetBlock getTarget()
|
|
{
|
|
return new TargetBlock(getBase());
|
|
}
|
|
|
|
public String getGroup()
|
|
{
|
|
try
|
|
{
|
|
return com.nijikokun.bukkit.Permissions.Permissions.Security.getGroup(getWorld().getName(), getName());
|
|
}
|
|
catch (Throwable ex)
|
|
{
|
|
return "default";
|
|
}
|
|
}
|
|
|
|
public boolean inGroup(String group)
|
|
{
|
|
try
|
|
{
|
|
return com.nijikokun.bukkit.Permissions.Permissions.Security.inGroup(getWorld().getName(), getName(), group);
|
|
}
|
|
catch (Throwable ex)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public boolean canBuild()
|
|
{
|
|
try
|
|
{
|
|
return com.nijikokun.bukkit.Permissions.Permissions.Security.canGroupBuild(getWorld().getName(), getGroup());
|
|
}
|
|
catch (Throwable ex)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public EntityPlayer getHandle()
|
|
{
|
|
return getCraftPlayer().getHandle();
|
|
}
|
|
|
|
public CraftPlayer getCraftPlayer()
|
|
{
|
|
return (CraftPlayer)base;
|
|
}
|
|
}
|