mirror of
https://github.com/essentials/Essentials.git
synced 2025-09-25 05:41:36 +02:00
Merge gravy's pull and reformat code
This commit is contained in:
@@ -1,109 +1,108 @@
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>net.essentials3</groupId>
|
||||
<artifactId>BuildAll</artifactId>
|
||||
<version>3.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<parent>
|
||||
<groupId>net.essentials3</groupId>
|
||||
<artifactId>BuildAll</artifactId>
|
||||
<version>3.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>Essentials</artifactId>
|
||||
<dependencies>
|
||||
<!-- Internal Depends -->
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>EssentialsGroupManager</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>0.11.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.4.1</version>
|
||||
</dependency>
|
||||
<!-- Test Depends -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.10</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>1.9.5</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- External Plugin Depends -->
|
||||
<dependency>
|
||||
<groupId>cosine</groupId>
|
||||
<artifactId>BOSEconomy</artifactId>
|
||||
<version>0.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.iConomy</groupId>
|
||||
<artifactId>iConomy</artifactId>
|
||||
<version>5.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.iCo6</groupId>
|
||||
<artifactId>iConomy</artifactId>
|
||||
<version>6.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.ashtheking</groupId>
|
||||
<artifactId>MultiCurrency</artifactId>
|
||||
<version>0.05</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl</groupId>
|
||||
<artifactId>Vault</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>commons-io:*</include>
|
||||
<include>org.apache.commons:*</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<minimizeJar>true</minimizeJar>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>org.apache.commons</pattern>
|
||||
<shadedPattern>net.ess3.commons</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<artifactId>Essentials</artifactId>
|
||||
<dependencies>
|
||||
<!-- Internal Depends -->
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>EssentialsGroupManager</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>0.11.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.4.1</version>
|
||||
</dependency>
|
||||
<!-- Test Depends -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.10</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>1.9.5</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- External Plugin Depends -->
|
||||
<dependency>
|
||||
<groupId>cosine</groupId>
|
||||
<artifactId>BOSEconomy</artifactId>
|
||||
<version>0.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.iConomy</groupId>
|
||||
<artifactId>iConomy</artifactId>
|
||||
<version>5.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.iCo6</groupId>
|
||||
<artifactId>iConomy</artifactId>
|
||||
<version>6.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.ashtheking</groupId>
|
||||
<artifactId>MultiCurrency</artifactId>
|
||||
<version>0.05</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl</groupId>
|
||||
<artifactId>Vault</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>commons-io:*</include>
|
||||
<include>org.apache.commons:*</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<minimizeJar>true</minimizeJar>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>org.apache.commons</pattern>
|
||||
<shadedPattern>net.ess3.commons</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package net.ess3;
|
||||
|
||||
import net.ess3.api.IReplyTo;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import net.ess3.api.IReplyTo;
|
||||
|
||||
|
||||
public final class Console implements IReplyTo
|
||||
|
@@ -17,15 +17,19 @@
|
||||
*/
|
||||
package net.ess3;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.InvalidDescriptionException;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.*;
|
||||
import net.ess3.backup.Backup;
|
||||
import net.ess3.commands.EssentialsCommandHandler;
|
||||
@@ -40,10 +44,6 @@ import net.ess3.settings.SpawnsHolder;
|
||||
import net.ess3.storage.StorageQueue;
|
||||
import net.ess3.user.UserMap;
|
||||
import net.ess3.utils.ExecuteTimer;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.InvalidDescriptionException;
|
||||
|
||||
|
||||
public class Essentials implements IEssentials
|
||||
|
@@ -2,12 +2,12 @@ package net.ess3;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import org.bukkit.entity.Player;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.ISettings;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.user.UserData.TimestampType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class EssentialsTimer implements Runnable
|
||||
|
@@ -66,7 +66,9 @@ public class I18n implements II18n
|
||||
}
|
||||
catch (MissingResourceException ex)
|
||||
{
|
||||
Logger.getLogger("Minecraft").log(Level.WARNING, String.format("Missing translation key \"%s\" in translation file %s", ex.getKey(), localeBundle.getLocale().toString()), ex);
|
||||
Logger.getLogger("Minecraft").log(
|
||||
Level.WARNING, String.format(
|
||||
"Missing translation key \"%s\" in translation file %s", ex.getKey(), localeBundle.getLocale().toString()), ex);
|
||||
return defaultBundle.getString(string);
|
||||
}
|
||||
}
|
||||
@@ -98,6 +100,7 @@ public class I18n implements II18n
|
||||
}
|
||||
return messageFormat.format(objects);
|
||||
}
|
||||
|
||||
private final Pattern partSplit = Pattern.compile("[_\\.]");
|
||||
|
||||
public void updateLocale(final String loc)
|
||||
@@ -127,10 +130,7 @@ public class I18n implements II18n
|
||||
|
||||
public static String capitalCase(final String input)
|
||||
{
|
||||
return input == null || input.length() == 0
|
||||
? input
|
||||
: input.toUpperCase(Locale.ENGLISH).charAt(0)
|
||||
+ input.toLowerCase(Locale.ENGLISH).substring(1);
|
||||
return input == null || input.length() == 0 ? input : input.toUpperCase(Locale.ENGLISH).charAt(0) + input.toLowerCase(Locale.ENGLISH).substring(1);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,18 +1,18 @@
|
||||
package net.ess3;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
import static net.ess3.I18n._;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.IItemDb;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.storage.ManagedFile;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
public class ItemDb implements IItemDb
|
||||
@@ -24,6 +24,7 @@ public class ItemDb implements IItemDb
|
||||
this.ess = ess;
|
||||
file = new ManagedFile("items.csv", ess);
|
||||
}
|
||||
|
||||
private final transient Map<String, Long> items = new HashMap<String, Long>();
|
||||
private final transient ManagedFile file;
|
||||
private static final Pattern SPLIT = Pattern.compile("[^a-zA-Z0-9]");
|
||||
@@ -91,6 +92,7 @@ public class ItemDb implements IItemDb
|
||||
retval.setAmount(quantity);
|
||||
return retval;
|
||||
}
|
||||
|
||||
private final Pattern idMatch = Pattern.compile("^\\d+[:+',;.]\\d+$");
|
||||
private final Pattern metaSplit = Pattern.compile("[:+',;.]");
|
||||
private final Pattern number = Pattern.compile("^\\d+$");
|
||||
|
@@ -1,14 +1,13 @@
|
||||
package net.ess3;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Locale;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.IJails;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.storage.AsyncStorageObjectHolder;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@@ -23,6 +22,10 @@ import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.IJails;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.storage.AsyncStorageObjectHolder;
|
||||
|
||||
|
||||
public class Jails extends AsyncStorageObjectHolder<net.ess3.settings.Jails> implements IJails
|
||||
@@ -48,8 +51,7 @@ public class Jails extends AsyncStorageObjectHolder<net.ess3.settings.Jails> imp
|
||||
@Override
|
||||
public Location getJail(final String jailName) throws Exception
|
||||
{
|
||||
if (getData().getJails() == null || jailName == null
|
||||
|| !getData().getJails().containsKey(jailName.toLowerCase(Locale.ENGLISH)))
|
||||
if (getData().getJails() == null || jailName == null || !getData().getJails().containsKey(jailName.toLowerCase(Locale.ENGLISH)))
|
||||
{
|
||||
throw new Exception(_("jailNotExist"));
|
||||
}
|
||||
|
@@ -1,8 +1,9 @@
|
||||
package net.ess3;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import static net.ess3.I18n._;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.IKits;
|
||||
import net.ess3.api.IUser;
|
||||
@@ -11,7 +12,6 @@ import net.ess3.settings.Kit;
|
||||
import net.ess3.storage.AsyncStorageObjectHolder;
|
||||
import net.ess3.user.UserData.TimestampType;
|
||||
import net.ess3.utils.DateUtil;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
public class Kits extends AsyncStorageObjectHolder<net.ess3.settings.Kits> implements IKits
|
||||
@@ -25,8 +25,7 @@ public class Kits extends AsyncStorageObjectHolder<net.ess3.settings.Kits> imple
|
||||
@Override
|
||||
public Kit getKit(String kitName) throws Exception
|
||||
{
|
||||
if (getData().getKits() == null || kitName == null
|
||||
|| !getData().getKits().containsKey(kitName.toLowerCase(Locale.ENGLISH)))
|
||||
if (getData().getKits() == null || kitName == null || !getData().getKits().containsKey(kitName.toLowerCase(Locale.ENGLISH)))
|
||||
{
|
||||
throw new Exception(_("kitError2"));
|
||||
}
|
||||
|
@@ -1,16 +1,6 @@
|
||||
package net.ess3;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.ISettings;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.bukkit.LivingEntities;
|
||||
import net.ess3.bukkit.LivingEntities.MobException;
|
||||
import net.ess3.commands.NotEnoughArgumentsException;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.user.User;
|
||||
import net.ess3.utils.LocationUtil;
|
||||
import net.ess3.utils.Util;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
import org.bukkit.DyeColor;
|
||||
@@ -21,6 +11,17 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.material.Colorable;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.ISettings;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.bukkit.LivingEntities;
|
||||
import net.ess3.bukkit.LivingEntities.MobException;
|
||||
import net.ess3.commands.NotEnoughArgumentsException;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.user.User;
|
||||
import net.ess3.utils.LocationUtil;
|
||||
import net.ess3.utils.Util;
|
||||
|
||||
|
||||
public class SpawnMob
|
||||
{
|
||||
@@ -149,7 +150,7 @@ public class SpawnMob
|
||||
|
||||
private static void spawnMob(final IEssentials ess, final Server server, final CommandSender sender, final IUser target, final Location sloc, EntityType mob, String mobData, EntityType mobMount, String mountData) throws Exception
|
||||
{
|
||||
|
||||
|
||||
final World spawningWorld = sloc.getWorld();
|
||||
final Entity spawnedMob = spawningWorld.spawn(sloc, (Class<? extends LivingEntity>)mob.getEntityClass());
|
||||
Entity spawnedMount = null;
|
||||
|
@@ -1,8 +1,11 @@
|
||||
package net.ess3;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
import static net.ess3.I18n._;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.ITeleport;
|
||||
import net.ess3.api.IUser;
|
||||
@@ -13,9 +16,6 @@ import net.ess3.user.UserData.TimestampType;
|
||||
import net.ess3.utils.DateUtil;
|
||||
import net.ess3.utils.LocationUtil;
|
||||
import net.ess3.utils.Target;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
|
||||
|
||||
public class Teleport implements Runnable, ITeleport
|
||||
@@ -25,8 +25,8 @@ public class Teleport implements Runnable, ITeleport
|
||||
private IUser user;
|
||||
private IUser teleportUser;
|
||||
private int teleTimer = -1;
|
||||
private long started; // time this task was initiated
|
||||
private long tpDelay; // how long to delay the teleport
|
||||
private long started; // time this task was initiated
|
||||
private long tpDelay; // how long to delay the teleport
|
||||
private int health;
|
||||
// note that I initially stored a clone of the location for reference, but...
|
||||
// when comparing locations, I got incorrect mismatches (rounding errors, looked like)
|
||||
@@ -43,7 +43,7 @@ public class Teleport implements Runnable, ITeleport
|
||||
{
|
||||
initTimer(delay, user, target, chargeFor, cause);
|
||||
}
|
||||
|
||||
|
||||
private void initTimer(long delay, IUser teleportUser, Target target, Trade chargeFor, TeleportCause cause)
|
||||
{
|
||||
this.started = System.currentTimeMillis();
|
||||
@@ -67,19 +67,18 @@ public class Teleport implements Runnable, ITeleport
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (teleportUser == null || !teleportUser.isOnline() || teleportUser.getPlayer().getLocation() == null)
|
||||
{
|
||||
cancel(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Permissions.TELEPORT_TIMER_MOVE.isAuthorized(user)
|
||||
&&(Math.round(teleportUser.getPlayer().getLocation().getX() * MOVE_CONSTANT) != initX
|
||||
|| Math.round(teleportUser.getPlayer().getLocation().getY() * MOVE_CONSTANT) != initY
|
||||
|| Math.round(teleportUser.getPlayer().getLocation().getZ() * MOVE_CONSTANT) != initZ
|
||||
|| teleportUser.getPlayer().getHealth() < health))
|
||||
{ // user moved, cancel teleport
|
||||
|
||||
if (!Permissions.TELEPORT_TIMER_MOVE.isAuthorized(user) && (Math.round(
|
||||
teleportUser.getPlayer().getLocation().getX() * MOVE_CONSTANT) != initX || Math.round(
|
||||
teleportUser.getPlayer().getLocation().getY() * MOVE_CONSTANT) != initY || Math.round(
|
||||
teleportUser.getPlayer().getLocation().getZ() * MOVE_CONSTANT) != initZ || teleportUser.getPlayer().getHealth() < health))
|
||||
{ // user moved, cancel teleport
|
||||
cancel(true);
|
||||
return;
|
||||
}
|
||||
@@ -124,7 +123,6 @@ public class Teleport implements Runnable, ITeleport
|
||||
this.ess = ess;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void cooldown(boolean check) throws Exception
|
||||
{
|
||||
@@ -168,7 +166,7 @@ public class Teleport implements Runnable, ITeleport
|
||||
{
|
||||
cancel(false);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void teleport(Location loc, Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
@@ -214,14 +212,15 @@ public class Teleport implements Runnable, ITeleport
|
||||
cancel();
|
||||
user.setLastLocation();
|
||||
final Location loc = LocationUtil.getSafeDestination(target.getLocation());
|
||||
ess.getPlugin().scheduleSyncDelayedTask(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
user.getPlayer().teleport(loc, cause);
|
||||
}
|
||||
});
|
||||
ess.getPlugin().scheduleSyncDelayedTask(
|
||||
new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
user.getPlayer().teleport(loc, cause);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -234,7 +233,7 @@ public class Teleport implements Runnable, ITeleport
|
||||
now(new Target(loc), cause);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
//The now function is used when you want to skip tp delay when teleporting someone to a location or player.
|
||||
public void now(Entity entity, boolean cooldown, TeleportCause cause) throws Exception
|
||||
@@ -245,14 +244,14 @@ public class Teleport implements Runnable, ITeleport
|
||||
}
|
||||
now(new Target(entity), cause);
|
||||
}
|
||||
|
||||
|
||||
public void now(Location loc, Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
cooldown(false);
|
||||
chargeFor.charge(user);
|
||||
now(new Target(loc), cause);
|
||||
}
|
||||
|
||||
|
||||
//The teleportToMe function is a wrapper used to handle teleporting players to them, like /tphere
|
||||
public void teleportToMe(IUser otherUser, Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
@@ -273,7 +272,8 @@ public class Teleport implements Runnable, ITeleport
|
||||
{
|
||||
chargeFor.charge(user);
|
||||
}
|
||||
return; }
|
||||
return;
|
||||
}
|
||||
|
||||
cancel(false);
|
||||
warnUser(otherUser, delay);
|
||||
@@ -281,7 +281,7 @@ public class Teleport implements Runnable, ITeleport
|
||||
|
||||
teleTimer = ess.getPlugin().scheduleSyncRepeatingTask(this, 10, 10);
|
||||
}
|
||||
|
||||
|
||||
private void warnUser(final IUser user, final double delay)
|
||||
{
|
||||
final Calendar c = new GregorianCalendar();
|
||||
@@ -289,19 +289,20 @@ public class Teleport implements Runnable, ITeleport
|
||||
c.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0));
|
||||
user.sendMessage(_("dontMoveMessage", DateUtil.formatDateDiff(c.getTimeInMillis())));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void respawn(final Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
final Location bed = user.getBedSpawnLocation();
|
||||
final Location respawnLoc = ess.getPlugin().callRespawnEvent(user.getPlayer(), bed == null ? user.getPlayer().getWorld().getSpawnLocation() : bed, bed != null);
|
||||
final Location respawnLoc = ess.getPlugin().callRespawnEvent(
|
||||
user.getPlayer(), bed == null ? user.getPlayer().getWorld().getSpawnLocation() : bed, bed != null);
|
||||
teleport(new Target(respawnLoc), chargeFor, cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warp(String warp, Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
final Location loc = ess.getWarps().getWarp(warp);
|
||||
final Location loc = ess.getWarps().getWarp(warp);
|
||||
user.sendMessage(_("warpingTo", warp));
|
||||
teleport(new Target(loc), chargeFor, cause);
|
||||
}
|
||||
|
@@ -1,8 +1,9 @@
|
||||
package net.ess3;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import static net.ess3.I18n._;
|
||||
import org.bukkit.Location;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.IWarp;
|
||||
import net.ess3.api.IWarps;
|
||||
@@ -10,7 +11,6 @@ import net.ess3.api.InvalidNameException;
|
||||
import net.ess3.commands.WarpNotFoundException;
|
||||
import net.ess3.settings.WarpHolder;
|
||||
import net.ess3.storage.StorageObjectMap;
|
||||
import org.bukkit.Location;
|
||||
|
||||
|
||||
public class Warps extends StorageObjectMap<IWarp> implements IWarps
|
||||
|
@@ -4,9 +4,9 @@ package net.ess3.api;
|
||||
public class ChargeException extends Exception
|
||||
{
|
||||
/**
|
||||
* Allow for serialization of the ChargeException class
|
||||
*/
|
||||
private static final long serialVersionUID = 200058474023860487L;
|
||||
* Allow for serialization of the ChargeException class
|
||||
*/
|
||||
private static final long serialVersionUID = 200058474023860487L;
|
||||
|
||||
public ChargeException(final String message)
|
||||
{
|
||||
|
@@ -12,14 +12,16 @@ public final class Economy
|
||||
private Economy()
|
||||
{
|
||||
}
|
||||
|
||||
private static IEssentials ess;
|
||||
private static final String noCallBeforeLoad = "Essentials API is called before Essentials is loaded.";
|
||||
|
||||
/**
|
||||
* Returns the balance of a user
|
||||
*
|
||||
* @param name Name of the user
|
||||
* @return balance
|
||||
* @throws UserDoesNotExistException
|
||||
* @throws UserDoesNotExistException
|
||||
*/
|
||||
public static double getMoney(String name) throws UserDoesNotExistException
|
||||
{
|
||||
@@ -32,10 +34,11 @@ public final class Economy
|
||||
|
||||
/**
|
||||
* Sets the balance of a user
|
||||
* @param name Name of the user
|
||||
*
|
||||
* @param name Name of the user
|
||||
* @param balance The balance you want to set
|
||||
* @throws UserDoesNotExistException If a user by that name does not exists
|
||||
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance
|
||||
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance
|
||||
*/
|
||||
public static void setMoney(String name, double balance) throws UserDoesNotExistException, NoLoanPermittedException
|
||||
{
|
||||
@@ -48,10 +51,11 @@ public final class Economy
|
||||
|
||||
/**
|
||||
* Adds money to the balance of a user
|
||||
* @param name Name of the user
|
||||
*
|
||||
* @param name Name of the user
|
||||
* @param amount The money you want to add
|
||||
* @throws UserDoesNotExistException If a user by that name does not exists
|
||||
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance
|
||||
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance
|
||||
*/
|
||||
public static void add(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException
|
||||
{
|
||||
@@ -61,10 +65,11 @@ public final class Economy
|
||||
|
||||
/**
|
||||
* Substracts money from the balance of a user
|
||||
* @param name Name of the user
|
||||
*
|
||||
* @param name Name of the user
|
||||
* @param amount The money you want to substract
|
||||
* @throws UserDoesNotExistException If a user by that name does not exists
|
||||
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance
|
||||
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance
|
||||
*/
|
||||
public static void subtract(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException
|
||||
{
|
||||
@@ -74,10 +79,11 @@ public final class Economy
|
||||
|
||||
/**
|
||||
* Divides the balance of a user by a value
|
||||
* @param name Name of the user
|
||||
*
|
||||
* @param name Name of the user
|
||||
* @param value The balance is divided by this value
|
||||
* @throws UserDoesNotExistException If a user by that name does not exists
|
||||
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance
|
||||
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance
|
||||
*/
|
||||
public static void divide(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException
|
||||
{
|
||||
@@ -87,10 +93,11 @@ public final class Economy
|
||||
|
||||
/**
|
||||
* Multiplies the balance of a user by a value
|
||||
* @param name Name of the user
|
||||
*
|
||||
* @param name Name of the user
|
||||
* @param value The balance is multiplied by this value
|
||||
* @throws UserDoesNotExistException If a user by that name does not exists
|
||||
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance
|
||||
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance
|
||||
*/
|
||||
public static void multiply(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException
|
||||
{
|
||||
@@ -100,9 +107,10 @@ public final class Economy
|
||||
|
||||
/**
|
||||
* Resets the balance of a user to the starting balance
|
||||
*
|
||||
* @param name Name of the user
|
||||
* @throws UserDoesNotExistException If a user by that name does not exists
|
||||
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance
|
||||
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance
|
||||
*/
|
||||
public static void resetBalance(String name) throws UserDoesNotExistException, NoLoanPermittedException
|
||||
{
|
||||
@@ -114,7 +122,7 @@ public final class Economy
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name Name of the user
|
||||
* @param name Name of the user
|
||||
* @param amount The amount of money the user should have
|
||||
* @return true, if the user has more or an equal amount of money
|
||||
* @throws UserDoesNotExistException If a user by that name does not exists
|
||||
@@ -125,7 +133,7 @@ public final class Economy
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name Name of the user
|
||||
* @param name Name of the user
|
||||
* @param amount The amount of money the user should have
|
||||
* @return true, if the user has more money
|
||||
* @throws UserDoesNotExistException If a user by that name does not exists
|
||||
@@ -136,7 +144,7 @@ public final class Economy
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name Name of the user
|
||||
* @param name Name of the user
|
||||
* @param amount The amount of money the user should not have
|
||||
* @return true, if the user has less money
|
||||
* @throws UserDoesNotExistException If a user by that name does not exists
|
||||
@@ -148,6 +156,7 @@ public final class Economy
|
||||
|
||||
/**
|
||||
* Test if the user has a negative balance
|
||||
*
|
||||
* @param name Name of the user
|
||||
* @return true, if the user has a negative balance
|
||||
* @throws UserDoesNotExistException If a user by that name does not exists
|
||||
@@ -160,6 +169,7 @@ public final class Economy
|
||||
/**
|
||||
* Formats the amount of money like all other Essentials functions.
|
||||
* Example: $100000 or $12345.67
|
||||
*
|
||||
* @param amount The amount of money
|
||||
* @return Formatted money
|
||||
*/
|
||||
@@ -174,6 +184,7 @@ public final class Economy
|
||||
|
||||
/**
|
||||
* Test if a player exists to avoid the UserDoesNotExistException
|
||||
*
|
||||
* @param name Name of the user
|
||||
* @return true, if the user exists
|
||||
*/
|
||||
@@ -188,9 +199,10 @@ public final class Economy
|
||||
|
||||
/**
|
||||
* Test if a player is a npc
|
||||
*
|
||||
* @param name Name of the player
|
||||
* @return true, if it's a npc
|
||||
* @throws UserDoesNotExistException
|
||||
* @throws UserDoesNotExistException
|
||||
*/
|
||||
public static boolean isNPC(String name) throws UserDoesNotExistException
|
||||
{
|
||||
@@ -203,6 +215,7 @@ public final class Economy
|
||||
|
||||
/**
|
||||
* Creates dummy files for a npc, if there is no player yet with that name.
|
||||
*
|
||||
* @param name Name of the player
|
||||
* @return true, if a new npc was created
|
||||
*/
|
||||
@@ -216,9 +229,10 @@ public final class Economy
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a user, if it is marked as npc.
|
||||
* Deletes a user, if it is marked as npc.
|
||||
*
|
||||
* @param name Name of the player
|
||||
* @throws UserDoesNotExistException
|
||||
* @throws UserDoesNotExistException
|
||||
*/
|
||||
public static void removeNPC(String name) throws UserDoesNotExistException
|
||||
{
|
||||
|
@@ -1,11 +1,12 @@
|
||||
package net.ess3.api;
|
||||
|
||||
public interface IComponent extends IReload {
|
||||
public interface IComponent extends IReload
|
||||
{
|
||||
/**
|
||||
* Enable the component.
|
||||
*/
|
||||
void onEnable();
|
||||
|
||||
|
||||
/**
|
||||
* Disable the component.
|
||||
*/
|
||||
|
@@ -2,13 +2,13 @@ package net.ess3.api;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import net.ess3.EssentialsTimer;
|
||||
import net.ess3.economy.register.Methods;
|
||||
import net.ess3.metrics.Metrics;
|
||||
import net.ess3.settings.SpawnsHolder;
|
||||
import net.ess3.storage.StorageQueue;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
|
||||
|
||||
public interface IEssentials extends IComponent
|
||||
@@ -64,7 +64,7 @@ public interface IEssentials extends IComponent
|
||||
void setMetrics(Metrics metrics);
|
||||
|
||||
SpawnsHolder getSpawns();
|
||||
|
||||
|
||||
StorageQueue getStorageQueue();
|
||||
|
||||
|
||||
}
|
||||
|
@@ -3,7 +3,6 @@ package net.ess3.api;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
|
||||
public interface IItemDb extends IReload
|
||||
{
|
||||
ItemStack get(final String name, final IUser user) throws Exception;
|
||||
|
@@ -16,6 +16,6 @@ public interface IKits extends IReload
|
||||
Collection<String> getList() throws Exception;
|
||||
|
||||
boolean isEmpty();
|
||||
|
||||
|
||||
void checkTime(final IUser user, Kit kit) throws NoChargeException;
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@ public interface IPermission
|
||||
|
||||
/**
|
||||
* Checks to see if a user can use this permission
|
||||
*
|
||||
* @param sender - CommandSender to check on
|
||||
* @return - True if they have that permission
|
||||
*/
|
||||
|
@@ -6,16 +6,20 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
public interface IPlugin extends Plugin {
|
||||
|
||||
|
||||
public interface IPlugin extends Plugin
|
||||
{
|
||||
|
||||
/**
|
||||
* Get an instance of essentials
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IEssentials getEssentials();
|
||||
|
||||
|
||||
/**
|
||||
* Schedule an a-sync task
|
||||
* Schedule an a-sync task
|
||||
*
|
||||
* @param run - Code to call later
|
||||
* @return - BukkitTask for the task created
|
||||
*/
|
||||
@@ -23,14 +27,16 @@ public interface IPlugin extends Plugin {
|
||||
|
||||
/**
|
||||
* Schedule a sync task (ran in main thread) to be run
|
||||
*
|
||||
* @param run - Code to be run later
|
||||
* @return - Integer for the task id
|
||||
*/
|
||||
int scheduleSyncDelayedTask(final Runnable run);
|
||||
|
||||
|
||||
/**
|
||||
* Call an a-sync task to be run with a given delay
|
||||
* @param run - Code to be run
|
||||
*
|
||||
* @param run - Code to be run
|
||||
* @param delay - Long that represents how long to wait
|
||||
* @return - BukkitTask for the task created
|
||||
*/
|
||||
@@ -38,7 +44,8 @@ public interface IPlugin extends Plugin {
|
||||
|
||||
/**
|
||||
* Schedule a sync (ran in main thread) delayed task
|
||||
* @param run - Code to run
|
||||
*
|
||||
* @param run - Code to run
|
||||
* @param delay - Long that represents how long to wait
|
||||
* @return - Integer of the task ID
|
||||
*/
|
||||
@@ -46,9 +53,9 @@ public interface IPlugin extends Plugin {
|
||||
|
||||
/**
|
||||
* Schedule a sync (in the main thread) repeating task
|
||||
*
|
||||
* @param run - Code to run
|
||||
* @param delay - Delay for the first run
|
||||
*
|
||||
* @param run - Code to run
|
||||
* @param delay - Delay for the first run
|
||||
* @param period - Time to wait between every run after the first
|
||||
* @return - int of the task ID
|
||||
*/
|
||||
@@ -56,8 +63,9 @@ public interface IPlugin extends Plugin {
|
||||
|
||||
/**
|
||||
* Schedule an a-sync repeating task
|
||||
* @param run - Code to run
|
||||
* @param delay - Delay for the first run
|
||||
*
|
||||
* @param run - Code to run
|
||||
* @param delay - Delay for the first run
|
||||
* @param period - Time to wait between every run after the first
|
||||
* @return - int of the task ID
|
||||
*/
|
||||
@@ -66,27 +74,29 @@ public interface IPlugin extends Plugin {
|
||||
File getRootFolder();
|
||||
|
||||
/**
|
||||
*
|
||||
* Stop a running task from a task id
|
||||
*
|
||||
* @param taskId
|
||||
*
|
||||
* @param taskId
|
||||
*/
|
||||
void cancelTask(final int taskId);
|
||||
|
||||
|
||||
/**
|
||||
* Stop a running task from a bukkit task
|
||||
*
|
||||
* @param taskId
|
||||
*/
|
||||
void cancelTask(final BukkitTask taskId);
|
||||
|
||||
/**
|
||||
* Get the essentials version
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getVersion();
|
||||
|
||||
/**
|
||||
* Load a class, currently needs updating
|
||||
*
|
||||
* @param name - class name
|
||||
* @return - loaded class
|
||||
*/
|
||||
@@ -94,8 +104,9 @@ public interface IPlugin extends Plugin {
|
||||
|
||||
/**
|
||||
* Call a re-spawn event on a player
|
||||
* @param player - Player to re-spawn
|
||||
* @param loc - Location to send
|
||||
*
|
||||
* @param player - Player to re-spawn
|
||||
* @param loc - Location to send
|
||||
* @param bedSpawn - do you use bed?
|
||||
* @return - Location after event called
|
||||
*/
|
||||
@@ -103,12 +114,14 @@ public interface IPlugin extends Plugin {
|
||||
|
||||
/**
|
||||
* Call a suicide event on a player
|
||||
*
|
||||
* @param player - Player to kill
|
||||
*/
|
||||
void callSuicideEvent(Player player);
|
||||
|
||||
/**
|
||||
* Finds if an essentials module is loaded
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
@@ -117,11 +130,12 @@ public interface IPlugin extends Plugin {
|
||||
public void onPluginEnable(Plugin plugin);
|
||||
|
||||
public void onPluginDisable(Plugin plugin);
|
||||
|
||||
|
||||
/**
|
||||
* Register a module with Essentils
|
||||
*
|
||||
* @param module - Your plugin instance
|
||||
*/
|
||||
void registerModule(Plugin module);
|
||||
|
||||
|
||||
}
|
||||
|
@@ -3,6 +3,7 @@ package net.ess3.api;
|
||||
import java.text.MessageFormat;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
/**
|
||||
* CommandSender object can be either IUser or Player
|
||||
*/
|
||||
|
@@ -3,7 +3,6 @@ package net.ess3.api;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
|
||||
public interface IReplyTo
|
||||
{
|
||||
void setReplyTo(CommandSender user);
|
||||
|
@@ -1,33 +1,34 @@
|
||||
package net.ess3.api;
|
||||
|
||||
import net.ess3.economy.Trade;
|
||||
import net.ess3.utils.Target;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import net.ess3.economy.Trade;
|
||||
import net.ess3.utils.Target;
|
||||
|
||||
|
||||
public interface ITeleport
|
||||
{
|
||||
/**
|
||||
* Teleport to a location now
|
||||
* @param loc - location to send to
|
||||
*
|
||||
* @param loc - location to send to
|
||||
* @param cooldown - To check cooldown
|
||||
* @param cause - Why was the send caused? Use a {@link TeleportCause}
|
||||
* @param cause - Why was the send caused? Use a {@link TeleportCause}
|
||||
* @throws Exception
|
||||
*/
|
||||
void now(Location loc, boolean cooldown, TeleportCause cause) throws Exception;
|
||||
|
||||
void now(Entity entity, boolean cooldown, TeleportCause cause) throws Exception;
|
||||
|
||||
void now(final Target target, final TeleportCause cause) throws Exception;
|
||||
|
||||
void now(final Target target, final TeleportCause cause) throws Exception;
|
||||
|
||||
void back(Trade chargeFor) throws Exception;
|
||||
|
||||
void teleport(Location bed, Trade charge, TeleportCause teleportCause) throws Exception;
|
||||
|
||||
void teleport(Entity entity, Trade chargeFor, TeleportCause cause) throws Exception;
|
||||
|
||||
|
||||
void teleportToMe(IUser otherUser, Trade chargeFor, TeleportCause cause) throws Exception;
|
||||
|
||||
void home(Location loc, Trade chargeFor) throws Exception;
|
||||
|
@@ -2,26 +2,28 @@ package net.ess3.api;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import net.ess3.storage.IStorageObjectHolder;
|
||||
import net.ess3.user.CooldownException;
|
||||
import net.ess3.user.UserData;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import net.ess3.storage.IStorageObjectHolder;
|
||||
import net.ess3.user.CooldownException;
|
||||
import net.ess3.user.UserData;
|
||||
|
||||
|
||||
public interface IUser extends OfflinePlayer, CommandSender, IStorageObjectHolder<UserData>, IReload, IReplyTo, Comparable<IUser>
|
||||
{
|
||||
/**
|
||||
* Get the ammount of money in a users account
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
double getMoney();
|
||||
|
||||
/**
|
||||
* Remove money from the account
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
void takeMoney(double value);
|
||||
@@ -131,9 +133,9 @@ public interface IUser extends OfflinePlayer, CommandSender, IStorageObjectHolde
|
||||
|
||||
boolean checkSignThrottle(int throttle);
|
||||
|
||||
public boolean isRecipeSee();
|
||||
public boolean isRecipeSee();
|
||||
|
||||
public void setRecipeSee(boolean recipeSee);
|
||||
public void setRecipeSee(boolean recipeSee);
|
||||
|
||||
/**
|
||||
* Since the Player object should not be stored for a long time, this method should be called again with a null
|
||||
@@ -145,7 +147,7 @@ public interface IUser extends OfflinePlayer, CommandSender, IStorageObjectHolde
|
||||
|
||||
/**
|
||||
* If this is not cached using the setPlayerCache method, this call is slow and should not be called often.
|
||||
*
|
||||
* <p/>
|
||||
* It iterates over all players, that are online and does a equal check on their names.
|
||||
*
|
||||
* @return
|
||||
|
@@ -2,9 +2,9 @@ package net.ess3.api;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Set;
|
||||
import org.bukkit.entity.Player;
|
||||
import net.ess3.user.PlayerNotFoundException;
|
||||
import net.ess3.user.TooManyMatchesException;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public interface IUserMap extends IReload
|
||||
|
@@ -3,6 +3,7 @@ package net.ess3.api;
|
||||
import net.ess3.settings.Warp;
|
||||
import net.ess3.storage.IStorageObjectHolder;
|
||||
|
||||
|
||||
/**
|
||||
* Warp interface
|
||||
*/
|
||||
|
@@ -9,6 +9,7 @@ public interface IWarps extends IReload
|
||||
{
|
||||
/**
|
||||
* Get a warp by name
|
||||
*
|
||||
* @param warp - Warp name
|
||||
* @return - Location the warp is set to
|
||||
* @throws Exception
|
||||
@@ -17,12 +18,14 @@ public interface IWarps extends IReload
|
||||
|
||||
/**
|
||||
* Gets a list of warps
|
||||
*
|
||||
* @return - A {@link Collection} of warps
|
||||
*/
|
||||
Collection<String> getList();
|
||||
|
||||
/**
|
||||
* Delete a warp from the warp DB
|
||||
*
|
||||
* @param name - Name of warp
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -30,23 +33,25 @@ public interface IWarps extends IReload
|
||||
|
||||
/**
|
||||
* Set a warp
|
||||
*
|
||||
* @param name - Name of warp
|
||||
* @param loc - Location of warp
|
||||
* @throws Exception
|
||||
* @param loc - Location of warp
|
||||
* @throws Exception
|
||||
*/
|
||||
void setWarp(String name, Location loc) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* Check to see if the file is empty
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isEmpty();
|
||||
|
||||
/**
|
||||
* Get a warp file
|
||||
*
|
||||
* @param name - name of file
|
||||
* @return - an instance of the file
|
||||
* @return - an instance of the file
|
||||
* @throws InvalidNameException - When the file is not found
|
||||
*/
|
||||
public File getWarpFile(String name) throws InvalidNameException;
|
||||
|
@@ -7,15 +7,17 @@ public interface IWorth extends IReload
|
||||
{
|
||||
/**
|
||||
* Get the price of an ItemStack
|
||||
*
|
||||
* @param itemStack - ItemStack to check
|
||||
* @return - double marking price
|
||||
*/
|
||||
double getPrice(ItemStack itemStack);
|
||||
|
||||
|
||||
/**
|
||||
* Set the price of an ItemStack
|
||||
*
|
||||
* @param itemStack - ItemStack to set price for
|
||||
* @param price - Price to set on item
|
||||
* @param price - Price to set on item
|
||||
*/
|
||||
void setPrice(ItemStack itemStack, double price);
|
||||
}
|
||||
|
@@ -4,9 +4,9 @@ package net.ess3.api;
|
||||
public class InvalidNameException extends Exception
|
||||
{
|
||||
/**
|
||||
* Allow serialization of the InvalidNameException exception
|
||||
*/
|
||||
private static final long serialVersionUID = 1485321420293663139L;
|
||||
* Allow serialization of the InvalidNameException exception
|
||||
*/
|
||||
private static final long serialVersionUID = 1485321420293663139L;
|
||||
|
||||
public InvalidNameException(Throwable thrwbl)
|
||||
{
|
||||
|
@@ -6,9 +6,9 @@ import static net.ess3.I18n._;
|
||||
public class NoLoanPermittedException extends Exception
|
||||
{
|
||||
/**
|
||||
* Allow serialization of the NoLoanPermittedException exception
|
||||
*/
|
||||
private static final long serialVersionUID = 1897047051293914036L;
|
||||
* Allow serialization of the NoLoanPermittedException exception
|
||||
*/
|
||||
private static final long serialVersionUID = 1897047051293914036L;
|
||||
|
||||
public NoLoanPermittedException()
|
||||
{
|
||||
|
@@ -6,9 +6,9 @@ import static net.ess3.I18n._;
|
||||
public class UserDoesNotExistException extends Exception
|
||||
{
|
||||
/**
|
||||
* Allow serialization of the UserDefinedFileAttributeView exception
|
||||
*/
|
||||
private static final long serialVersionUID = -6540804196206916310L;
|
||||
* Allow serialization of the UserDefinedFileAttributeView exception
|
||||
*/
|
||||
private static final long serialVersionUID = -6540804196206916310L;
|
||||
|
||||
public UserDoesNotExistException(String name)
|
||||
{
|
||||
|
@@ -1,16 +1,16 @@
|
||||
package net.ess3.backup;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.logging.Level;
|
||||
import static net.ess3.I18n._;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import net.ess3.api.IBackup;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.ISettings;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
public class Backup implements Runnable, IBackup
|
||||
@@ -54,28 +54,28 @@ public class Backup implements Runnable, IBackup
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
final ISettings settings = ess.getSettings();
|
||||
|
||||
|
||||
final net.ess3.settings.Backup backupSettings = settings.getData().getGeneral().getBackup();
|
||||
|
||||
String backupCommand = backupSettings.getCommand() == null || backupSettings.getCommand().isEmpty()
|
||||
? ("NORUN") : backupSettings.getCommand();
|
||||
|
||||
String backupCommand = backupSettings.getCommand() == null || backupSettings.getCommand().isEmpty() ? ("NORUN") : backupSettings.getCommand();
|
||||
|
||||
/*if (backupCommand.equals("NORUN")) { TODO: Un-comment if you do not want commands to be run if there is no backup command
|
||||
return;
|
||||
}*/
|
||||
|
||||
|
||||
ess.getLogger().log(Level.INFO, _("backupStarted"));
|
||||
|
||||
if (!backupSettings.getCommandsBeforeBackup().isEmpty())
|
||||
|
||||
if (!backupSettings.getCommandsBeforeBackup().isEmpty())
|
||||
{
|
||||
final CommandSender consoleSender = server.getConsoleSender();
|
||||
for (String command : backupSettings.getCommandsBeforeBackup()) {
|
||||
for (String command : backupSettings.getCommandsBeforeBackup())
|
||||
{
|
||||
server.dispatchCommand(consoleSender, command);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ess.getPlugin().scheduleAsyncDelayedTask(new BackupRunner(backupCommand));
|
||||
}
|
||||
|
||||
|
@@ -1,21 +1,12 @@
|
||||
package net.ess3.bukkit;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import net.ess3.Essentials;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.IPlugin;
|
||||
import net.ess3.listener.EssentialsBlockListener;
|
||||
import net.ess3.listener.EssentialsEntityListener;
|
||||
import net.ess3.listener.EssentialsPlayerListener;
|
||||
import net.ess3.listener.EssentialsPluginListener;
|
||||
import net.ess3.metrics.MetricsListener;
|
||||
import net.ess3.metrics.MetricsStarter;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -31,6 +22,15 @@ import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.plugin.java.JavaPluginLoader;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import net.ess3.Essentials;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.IPlugin;
|
||||
import net.ess3.listener.EssentialsBlockListener;
|
||||
import net.ess3.listener.EssentialsEntityListener;
|
||||
import net.ess3.listener.EssentialsPlayerListener;
|
||||
import net.ess3.listener.EssentialsPluginListener;
|
||||
import net.ess3.metrics.MetricsListener;
|
||||
import net.ess3.metrics.MetricsStarter;
|
||||
|
||||
|
||||
public class BukkitPlugin extends JavaPlugin implements IPlugin
|
||||
@@ -62,14 +62,15 @@ public class BukkitPlugin extends JavaPlugin implements IPlugin
|
||||
getLogger().log(Level.SEVERE, _("essentialsHelp2"));
|
||||
}
|
||||
getLogger().log(Level.SEVERE, ex.toString());
|
||||
pm.registerEvents(new Listener()
|
||||
{
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onPlayerJoin(final PlayerJoinEvent event)
|
||||
{
|
||||
event.getPlayer().sendMessage("Essentials failed to load, read the log file.");
|
||||
}
|
||||
}, this);
|
||||
pm.registerEvents(
|
||||
new Listener()
|
||||
{
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onPlayerJoin(final PlayerJoinEvent event)
|
||||
{
|
||||
event.getPlayer().sendMessage("Essentials failed to load, read the log file.");
|
||||
}
|
||||
}, this);
|
||||
for (Player player : getServer().getOnlinePlayers())
|
||||
{
|
||||
player.sendMessage("Essentials failed to load, read the log file.");
|
||||
@@ -178,13 +179,13 @@ public class BukkitPlugin extends JavaPlugin implements IPlugin
|
||||
{
|
||||
getServer().getScheduler().cancelTask(taskId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void cancelTask(BukkitTask taskId)
|
||||
public void cancelTask(BukkitTask taskId)
|
||||
{
|
||||
getServer().getScheduler().cancelTask(taskId.getTaskId());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getVersion()
|
||||
{
|
||||
@@ -228,17 +229,16 @@ public class BukkitPlugin extends JavaPlugin implements IPlugin
|
||||
@Override
|
||||
public void onPluginEnable(final Plugin plugin)
|
||||
{
|
||||
if (plugin.getName().equals(this.getName())
|
||||
|| !plugin.getName().startsWith("Essentials"))
|
||||
if (plugin.getName().equals(this.getName()) || !plugin.getName().startsWith("Essentials"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Remove "Essentials" from name
|
||||
modules.put(plugin.getName().substring(10), plugin);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerModule(Plugin module)
|
||||
public void registerModule(Plugin module)
|
||||
{ // TODO: Use, solution for L231
|
||||
modules.put(module.getName().substring(10), module);
|
||||
}
|
||||
@@ -246,8 +246,7 @@ public class BukkitPlugin extends JavaPlugin implements IPlugin
|
||||
@Override
|
||||
public void onPluginDisable(final Plugin plugin)
|
||||
{
|
||||
if (plugin.getName().equals(this.getName())
|
||||
|| !plugin.getName().startsWith("Essentials"))
|
||||
if (plugin.getName().equals(this.getName()) || !plugin.getName().startsWith("Essentials"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ public final class Enchantments
|
||||
private Enchantments()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
private static final transient Pattern NUMPATTERN = Pattern.compile("\\d+");
|
||||
private static final Map<String, Enchantment> ENCHANTMENTS = new HashMap<String, Enchantment>();
|
||||
|
||||
@@ -112,12 +112,16 @@ public final class Enchantments
|
||||
ENCHANTMENTS.put("unlimited", Enchantment.ARROW_INFINITE);
|
||||
ENCHANTMENTS.put("unlimitedarrows", Enchantment.ARROW_INFINITE);
|
||||
}
|
||||
|
||||
public static Enchantment getByName(final String name) {
|
||||
|
||||
public static Enchantment getByName(final String name)
|
||||
{
|
||||
Enchantment enchantment;
|
||||
if (NUMPATTERN.matcher(name).matches()) {
|
||||
if (NUMPATTERN.matcher(name).matches())
|
||||
{
|
||||
enchantment = Enchantment.getById(Integer.parseInt(name));
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
enchantment = Enchantment.getByName(name.toUpperCase(Locale.ENGLISH));
|
||||
}
|
||||
if (enchantment == null)
|
||||
|
@@ -1,19 +1,14 @@
|
||||
package net.ess3.bukkit;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.*;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
|
||||
public class LivingEntities
|
||||
{
|
||||
final private static Map<String, EntityType> entities = new HashMap<String, EntityType>();
|
||||
|
||||
|
||||
final private static EnumMap<EntityType, String> entityI18n = new EnumMap<EntityType, String>(EntityType.class);
|
||||
final private static EnumMap<EntityType, String> entityI18nPlural = new EnumMap<EntityType, String>(EntityType.class);
|
||||
|
||||
@@ -26,7 +21,7 @@ public class LivingEntities
|
||||
String entityName = entityType.name().toLowerCase(Locale.ENGLISH).replace("_", "");
|
||||
entities.put(entityName, entityType);
|
||||
entityI18n.put(entityType, entityName);
|
||||
entityI18nPlural.put(entityType,entityName+"Plural");
|
||||
entityI18nPlural.put(entityType, entityName + "Plural");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,10 +36,11 @@ public class LivingEntities
|
||||
return entities.get(name.toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
public static String getName(int count, EntityType type) {
|
||||
return count == 1? _(entityI18n.get(type)):_(entityI18nPlural.get(type));
|
||||
public static String getName(int count, EntityType type)
|
||||
{
|
||||
return count == 1 ? _(entityI18n.get(type)) : _(entityI18nPlural.get(type));
|
||||
}
|
||||
|
||||
|
||||
public static class MobException extends Exception
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@@ -1,12 +1,12 @@
|
||||
package net.ess3.bukkit;
|
||||
|
||||
import java.util.StringTokenizer;
|
||||
import net.ess3.api.IPermission;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import net.ess3.api.IPermission;
|
||||
|
||||
|
||||
public class PermissionFactory
|
||||
|
@@ -1,17 +1,18 @@
|
||||
package net.ess3.bukkit;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import static net.ess3.I18n._;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
|
||||
public class VersionCheck
|
||||
{
|
||||
public static final int BUKKIT_VERSION = 2015;
|
||||
private static final Pattern bukkitVersionPattern = Pattern.compile("git-Bukkit-(?:(?:[0-9]+)\\.)+[0-9]+-R[\\.0-9]+-(?:[0-9]+-g[0-9a-f]+-)?b([0-9]+)jnks.*");
|
||||
private static final Pattern bukkitVersionPattern = Pattern.compile(
|
||||
"git-Bukkit-(?:(?:[0-9]+)\\.)+[0-9]+-R[\\.0-9]+-(?:[0-9]+-g[0-9a-f]+-)?b([0-9]+)jnks.*");
|
||||
|
||||
public static boolean checkVersion(final org.bukkit.plugin.Plugin plugin)
|
||||
{
|
||||
@@ -20,8 +21,7 @@ public class VersionCheck
|
||||
final Logger log = plugin.getLogger();
|
||||
for (org.bukkit.plugin.Plugin p : pm.getPlugins())
|
||||
{
|
||||
if (p.getDescription().getName().startsWith("Essentials")
|
||||
&& !p.getDescription().getVersion().equals(pluginVersion))
|
||||
if (p.getDescription().getName().startsWith("Essentials") && !p.getDescription().getVersion().equals(pluginVersion))
|
||||
{
|
||||
p.getLogger().log(Level.WARNING, _("versionMismatch", p.getDescription().getName()));
|
||||
}
|
||||
|
@@ -37,5 +37,5 @@ public class Commandafk extends EssentialsCommand
|
||||
//user.sendMessage(_("markedAsAway"));
|
||||
ess.broadcastMessage(user, _("userIsAway", user.getPlayer().getDisplayName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IBackup;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import net.ess3.api.IBackup;
|
||||
|
||||
|
||||
public class Commandbackup extends EssentialsCommand
|
||||
|
@@ -1,10 +1,10 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.utils.FormatUtil;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
public class Commandbalance extends EssentialsCommand
|
||||
@@ -22,10 +22,7 @@ public class Commandbalance extends EssentialsCommand
|
||||
@Override
|
||||
public void run(final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
final double bal = (args.length < 1
|
||||
|| !Permissions.BALANCE_OTHERS.isAuthorized(user)
|
||||
? user
|
||||
: ess.getUserMap().matchUser(args[0], true)).getMoney();
|
||||
final double bal = (args.length < 1 || !Permissions.BALANCE_OTHERS.isAuthorized(user) ? user : ess.getUserMap().matchUser(args[0], true)).getMoney();
|
||||
user.sendMessage(_("balance", FormatUtil.displayCurrency(bal, ess)));
|
||||
}
|
||||
}
|
||||
|
@@ -1,17 +1,17 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import java.text.DateFormat;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import static net.ess3.I18n._;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.user.UserData;
|
||||
import net.ess3.utils.FormatUtil;
|
||||
import net.ess3.utils.textreader.ArrayListInput;
|
||||
import net.ess3.utils.textreader.TextPager;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
public class Commandbalancetop extends EssentialsCommand
|
||||
@@ -43,9 +43,7 @@ public class Commandbalancetop extends EssentialsCommand
|
||||
user.getData().setBalancetopHide(!user.getData().isBalancetopHide());
|
||||
user.queueSave();
|
||||
sender.sendMessage(
|
||||
user.getData().isBalancetopHide()
|
||||
? _("baltopHidden")
|
||||
: _("baltopShown"));
|
||||
user.getData().isBalancetopHide() ? _("baltopHidden") : _("baltopShown"));
|
||||
}
|
||||
else if (args.length == 2 && Permissions.BALANCETOP_HIDE_OTHERS.isAuthorized(sender))
|
||||
{
|
||||
@@ -54,9 +52,7 @@ public class Commandbalancetop extends EssentialsCommand
|
||||
userData.setBalancetopHide(!userData.isBalancetopHide());
|
||||
user.queueSave();
|
||||
sender.sendMessage(
|
||||
userData.isBalancetopHide()
|
||||
? user.getName() + _("userBaltopHidden")
|
||||
: user.getName() + _("userBaltopShown"));
|
||||
userData.isBalancetopHide() ? user.getName() + _("userBaltopHidden") : user.getName() + _("userBaltopShown"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -149,7 +145,8 @@ public class Commandbalancetop extends EssentialsCommand
|
||||
}
|
||||
|
||||
final List<Map.Entry<String, Double>> sortedEntries = new ArrayList<Map.Entry<String, Double>>(balances.entrySet());
|
||||
Collections.sort(sortedEntries, new Comparator<Map.Entry<String, Double>>()
|
||||
Collections.sort(
|
||||
sortedEntries, new Comparator<Map.Entry<String, Double>>()
|
||||
{
|
||||
@Override
|
||||
public int compare(final Entry<String, Double> entry1, final Entry<String, Double> entry2)
|
||||
|
@@ -1,15 +1,14 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import net.ess3.Console;
|
||||
import static net.ess3.I18n._;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import net.ess3.Console;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.user.Ban;
|
||||
import net.ess3.user.UserData;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class Commandban extends EssentialsCommand
|
||||
{
|
||||
@@ -44,7 +43,7 @@ public class Commandban extends EssentialsCommand
|
||||
userData.setBan(new Ban());
|
||||
if (args.length > 1)
|
||||
{
|
||||
|
||||
|
||||
banReason = _("banFormat", getFinalArg(args, 1), senderName);
|
||||
userData.getBan().setReason(banReason);
|
||||
}
|
||||
@@ -53,7 +52,7 @@ public class Commandban extends EssentialsCommand
|
||||
banReason = _("banFormat", _("defaultBanReason"), senderName);
|
||||
userData.getBan().setReason("");
|
||||
}
|
||||
|
||||
|
||||
user.setBanned(true);
|
||||
user.queueSave();
|
||||
user.getPlayer().kickPlayer(banReason);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IUser;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import net.ess3.api.IUser;
|
||||
|
||||
|
||||
public class Commandbanip extends EssentialsCommand
|
||||
|
@@ -1,10 +1,10 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.utils.LocationUtil;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.TreeType;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.utils.LocationUtil;
|
||||
|
||||
|
||||
public class Commandbigtree extends EssentialsCommand
|
||||
|
@@ -1,11 +1,12 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
|
||||
|
||||
public class Commandbreak extends EssentialsCommand
|
||||
{
|
||||
|
@@ -1,9 +1,8 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.utils.FormatUtil;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import net.ess3.utils.FormatUtil;
|
||||
|
||||
|
||||
public class Commandbroadcast extends EssentialsCommand
|
||||
|
@@ -1,9 +1,9 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IUser;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import net.ess3.api.IUser;
|
||||
|
||||
|
||||
public class Commandburn extends EssentialsCommand
|
||||
|
@@ -1,11 +1,11 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import java.util.List;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import java.util.List;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
|
||||
|
||||
public class Commandclearinventory extends EssentialsCommand
|
||||
|
@@ -1,11 +1,11 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
import static net.ess3.I18n._;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
public class Commanddelhome extends EssentialsCommand
|
||||
@@ -48,10 +48,10 @@ public class Commanddelhome extends EssentialsCommand
|
||||
{
|
||||
name = expandedArg[0];
|
||||
}
|
||||
if (name.equalsIgnoreCase("bed"))
|
||||
{
|
||||
throw new Exception (_("vanillaHome"));
|
||||
}
|
||||
if (name.equalsIgnoreCase("bed"))
|
||||
{
|
||||
throw new Exception(_("vanillaHome"));
|
||||
}
|
||||
user.getData().removeHome(name.toLowerCase(Locale.ENGLISH));
|
||||
user.queueSave();
|
||||
sender.sendMessage(_("deleteHome", name));
|
||||
|
@@ -1,11 +1,11 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import java.util.Locale;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.ISettings;
|
||||
import net.ess3.api.IUser;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import net.ess3.api.ISettings;
|
||||
import net.ess3.api.IUser;
|
||||
|
||||
|
||||
public class Commandeco extends EssentialsCommand
|
||||
|
@@ -1,17 +1,17 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import static net.ess3.I18n._;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.bukkit.Enchantments;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.utils.Util;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
public class Commandenchant extends EssentialsCommand
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
|
||||
@@ -11,7 +10,7 @@ public class Commandenderchest extends EssentialsCommand
|
||||
|
||||
@Override
|
||||
protected void run(final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
{
|
||||
final Player player = user.getPlayer();
|
||||
if (args.length > 0 && Permissions.ENDERCHEST_OTHERS.isAuthorized(user))
|
||||
{
|
||||
|
@@ -1,14 +1,14 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import java.util.Map;
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.Map;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
public class Commandessentials extends EssentialsCommand
|
||||
{
|
||||
private transient int taskid; // TODO: Needed?
|
||||
|
||||
|
||||
@Override
|
||||
protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
|
@@ -1,11 +1,11 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.craftbukkit.SetExpFix;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.utils.Util;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
public class Commandexp extends EssentialsCommand
|
||||
@@ -13,7 +13,7 @@ public class Commandexp extends EssentialsCommand
|
||||
@Override
|
||||
public void run(final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
|
||||
|
||||
if (args.length == 0)
|
||||
{
|
||||
showExp(user, user);
|
||||
@@ -89,7 +89,7 @@ public class Commandexp extends EssentialsCommand
|
||||
boolean foundUser = false;
|
||||
for (IUser matchPlayer : ess.getUserMap().matchUsersExcludingHidden(match, getPlayerOrNull(sender)))
|
||||
{
|
||||
foundUser = true;
|
||||
foundUser = true;
|
||||
showExp(sender, matchPlayer);
|
||||
}
|
||||
if (!foundUser)
|
||||
@@ -102,7 +102,7 @@ public class Commandexp extends EssentialsCommand
|
||||
{
|
||||
boolean foundUser = false;
|
||||
for (IUser matchPlayer : ess.getUserMap().matchUsersExcludingHidden(match, getPlayerOrNull(sender)))
|
||||
{
|
||||
{
|
||||
setExp(sender, matchPlayer, amount, toggle);
|
||||
foundUser = true;
|
||||
}
|
||||
@@ -115,8 +115,10 @@ public class Commandexp extends EssentialsCommand
|
||||
private void showExp(final CommandSender sender, final IUser target)
|
||||
{
|
||||
final int totalExp = SetExpFix.getTotalExperience(target.getPlayer());
|
||||
final int expLeft = (int)Util.roundDouble(((((3.5 * target.getPlayer().getLevel()) + 6.7) - (totalExp - ((1.75 * (target.getPlayer().getLevel() * target.getPlayer().getLevel())) + (5.00 * target.getPlayer().getLevel())))) + 1));
|
||||
sender.sendMessage(_("exp", target.getPlayer().getDisplayName(), SetExpFix.getTotalExperience(target.getPlayer()), target.getPlayer().getLevel(), expLeft));
|
||||
final int expLeft = (int)Util.roundDouble(
|
||||
((((3.5 * target.getPlayer().getLevel()) + 6.7) - (totalExp - ((1.75 * (target.getPlayer().getLevel() * target.getPlayer().getLevel())) + (5.00 * target.getPlayer().getLevel())))) + 1));
|
||||
sender.sendMessage(
|
||||
_("exp", target.getPlayer().getDisplayName(), SetExpFix.getTotalExperience(target.getPlayer()), target.getPlayer().getLevel(), expLeft));
|
||||
}
|
||||
|
||||
private void setExp(final CommandSender sender, final IUser target, final String strAmount, final boolean give)
|
||||
|
@@ -1,9 +1,9 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IUser;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import net.ess3.api.IUser;
|
||||
|
||||
|
||||
public class Commandext extends EssentialsCommand
|
||||
|
@@ -1,11 +1,11 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import java.util.Set;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import java.util.Set;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
|
||||
|
||||
public class Commandfeed extends EssentialsCommand
|
||||
@@ -35,7 +35,7 @@ public class Commandfeed extends EssentialsCommand
|
||||
return;
|
||||
}
|
||||
for (IUser player : users)
|
||||
{
|
||||
{
|
||||
final Player realPlayer = player.getPlayer();
|
||||
realPlayer.setFoodLevel(20);
|
||||
realPlayer.setSaturation(10);
|
||||
|
@@ -1,10 +1,10 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import net.ess3.api.IUser;
|
||||
import org.bukkit.entity.Fireball;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.SmallFireball;
|
||||
import org.bukkit.util.Vector;
|
||||
import net.ess3.api.IUser;
|
||||
|
||||
|
||||
public class Commandfireball extends EssentialsCommand
|
||||
@@ -17,11 +17,12 @@ public class Commandfireball extends EssentialsCommand
|
||||
{
|
||||
small = true;
|
||||
}
|
||||
|
||||
|
||||
final Player player = user.getPlayer();
|
||||
|
||||
|
||||
final Vector direction = player.getEyeLocation().getDirection().multiply(2);
|
||||
final Fireball fireball = player.getWorld().spawn(player.getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), small ? SmallFireball.class : Fireball.class);
|
||||
final Fireball fireball = player.getWorld().spawn(
|
||||
player.getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), small ? SmallFireball.class : Fireball.class);
|
||||
fireball.setShooter(player);
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +1,11 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import java.util.Locale;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
|
||||
|
||||
public class Commandgamemode extends EssentialsSettingsCommand
|
||||
@@ -13,7 +13,8 @@ public class Commandgamemode extends EssentialsSettingsCommand
|
||||
|
||||
protected void setValue(final IUser player, GameMode value)
|
||||
{
|
||||
if (value == null) {
|
||||
if (value == null)
|
||||
{
|
||||
value = rotateGameMode(player);
|
||||
}
|
||||
player.getPlayer().setGameMode(value);
|
||||
@@ -26,10 +27,12 @@ public class Commandgamemode extends EssentialsSettingsCommand
|
||||
|
||||
protected void informSender(final CommandSender sender, final boolean value, final IUser player)
|
||||
{
|
||||
if (value) {
|
||||
sender.sendMessage( _("gameMode", getValue(player).toString().toLowerCase(Locale.ENGLISH), player.getPlayer().getDisplayName()));
|
||||
if (value)
|
||||
{
|
||||
sender.sendMessage(_("gameMode", getValue(player).toString().toLowerCase(Locale.ENGLISH), player.getPlayer().getDisplayName()));
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
sender.sendMessage(_("gamemodeFailed", player.getName()));
|
||||
}
|
||||
}
|
||||
@@ -57,11 +60,13 @@ public class Commandgamemode extends EssentialsSettingsCommand
|
||||
|
||||
protected boolean canMatch(final String arg)
|
||||
{
|
||||
try {
|
||||
try
|
||||
{
|
||||
matchGameMode(arg);
|
||||
return true;
|
||||
}
|
||||
catch (NotEnoughArgumentsException ex) {
|
||||
catch (NotEnoughArgumentsException ex)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -72,35 +77,37 @@ public class Commandgamemode extends EssentialsSettingsCommand
|
||||
{
|
||||
setValue(player, null);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
setValue(player, matchGameMode(arg));
|
||||
}
|
||||
}
|
||||
|
||||
private GameMode rotateGameMode(final IUser player) {
|
||||
private GameMode rotateGameMode(final IUser player)
|
||||
{
|
||||
return getValue(player) == GameMode.SURVIVAL ? GameMode.CREATIVE : getValue(player) == GameMode.CREATIVE ? GameMode.ADVENTURE : GameMode.SURVIVAL;
|
||||
}
|
||||
|
||||
private GameMode matchGameMode(String modeString) throws NotEnoughArgumentsException
|
||||
{
|
||||
final GameMode mode;
|
||||
if (modeString.equalsIgnoreCase("gmc") || modeString.equalsIgnoreCase("egmc")
|
||||
|| modeString.contains("creat") || modeString.equalsIgnoreCase("1") || modeString.equalsIgnoreCase("c"))
|
||||
if (modeString.equalsIgnoreCase("gmc") || modeString.equalsIgnoreCase("egmc") || modeString.contains("creat") || modeString.equalsIgnoreCase(
|
||||
"1") || modeString.equalsIgnoreCase("c"))
|
||||
{
|
||||
mode = GameMode.CREATIVE;
|
||||
}
|
||||
else if (modeString.equalsIgnoreCase("gms") || modeString.equalsIgnoreCase("egms")
|
||||
|| modeString.contains("survi") || modeString.equalsIgnoreCase("0") || modeString.equalsIgnoreCase("s"))
|
||||
else if (modeString.equalsIgnoreCase("gms") || modeString.equalsIgnoreCase("egms") || modeString.contains("survi") || modeString.equalsIgnoreCase(
|
||||
"0") || modeString.equalsIgnoreCase("s"))
|
||||
{
|
||||
mode = GameMode.SURVIVAL;
|
||||
}
|
||||
else if (modeString.equalsIgnoreCase("gma") || modeString.equalsIgnoreCase("egma")
|
||||
|| modeString.contains("advent") || modeString.equalsIgnoreCase("2") || modeString.equalsIgnoreCase("a"))
|
||||
else if (modeString.equalsIgnoreCase("gma") || modeString.equalsIgnoreCase("egma") || modeString.contains("advent") || modeString.equalsIgnoreCase(
|
||||
"2") || modeString.equalsIgnoreCase("a"))
|
||||
{
|
||||
mode = GameMode.ADVENTURE;
|
||||
}
|
||||
else if (modeString.equalsIgnoreCase("gmt") || modeString.equalsIgnoreCase("egmt")
|
||||
|| modeString.contains("toggle") || modeString.contains("cycle") || modeString.equalsIgnoreCase("t"))
|
||||
else if (modeString.equalsIgnoreCase("gmt") || modeString.equalsIgnoreCase("egmt") || modeString.contains("toggle") || modeString.contains(
|
||||
"cycle") || modeString.equalsIgnoreCase("t"))
|
||||
{
|
||||
mode = null;
|
||||
}
|
||||
|
@@ -1,11 +1,11 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.utils.DateUtil;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import net.ess3.utils.DateUtil;
|
||||
|
||||
|
||||
public class Commandgc extends EssentialsCommand
|
||||
@@ -33,7 +33,7 @@ public class Commandgc extends EssentialsCommand
|
||||
sender.sendMessage(_("gcmax", (runtime.maxMemory() / 1024 / 1024)));
|
||||
sender.sendMessage(_("gctotal", (runtime.totalMemory() / 1024 / 1024)));
|
||||
sender.sendMessage(_("gcfree", (runtime.freeMemory() / 1024 / 1024)));
|
||||
sender.sendMessage(_("gcquene", (ess.getStorageQueue().getQueueSize())));
|
||||
sender.sendMessage(_("gcquene", (ess.getStorageQueue().getQueueSize())));
|
||||
|
||||
for (World w : server.getWorlds())
|
||||
{
|
||||
@@ -49,13 +49,11 @@ public class Commandgc extends EssentialsCommand
|
||||
default:
|
||||
worldType = "World";
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
sender.sendMessage(
|
||||
worldType + " \"" + w.getName() + "\": "
|
||||
+ w.getLoadedChunks().length + _("gcchunks")
|
||||
+ w.getEntities().size() + _("gcentities"));
|
||||
worldType + " \"" + w.getName() + "\": " + w.getLoadedChunks().length + _("gcchunks") + w.getEntities().size() + _("gcentities"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,14 +1,12 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import static net.ess3.I18n._;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
|
||||
|
||||
public class Commandgetpos extends EssentialsCommand
|
||||
|
@@ -1,14 +1,14 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.utils.Util;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.utils.Util;
|
||||
|
||||
|
||||
public class Commandgive extends EssentialsCommand
|
||||
@@ -81,7 +81,7 @@ public class Commandgive extends EssentialsCommand
|
||||
giveTo.giveItems(stack, false);
|
||||
|
||||
final String itemName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' ');
|
||||
sender.sendMessage( _("give", stack.getAmount(), itemName, giveTo.getPlayer().getDisplayName()));
|
||||
sender.sendMessage(_("give", stack.getAmount(), itemName, giveTo.getPlayer().getDisplayName()));
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -1,13 +1,12 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.craftbukkit.InventoryWorkaround;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.craftbukkit.InventoryWorkaround;
|
||||
|
||||
|
||||
public class Commandhat extends EssentialsCommand
|
||||
|
@@ -1,12 +1,12 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import java.util.Set;
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.Set;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.user.UserData.TimestampType;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class Commandheal extends EssentialsCommand
|
||||
@@ -24,7 +24,7 @@ public class Commandheal extends EssentialsCommand
|
||||
}
|
||||
|
||||
user.checkCooldown(TimestampType.LASTHEAL, ess.getRanks().getHealCooldown(user), true, Permissions.HEAL_COOLDOWN_BYPASS);
|
||||
|
||||
|
||||
final Player player = user.getPlayer();
|
||||
player.setHealth(20);
|
||||
player.setFireTicks(0);
|
||||
@@ -52,7 +52,7 @@ public class Commandheal extends EssentialsCommand
|
||||
return;
|
||||
}
|
||||
for (IUser p : users)
|
||||
{
|
||||
{
|
||||
final Player player = p.getPlayer();
|
||||
player.setHealth(20);
|
||||
player.setFoodLevel(20);
|
||||
|
@@ -1,12 +1,11 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import java.util.Locale;
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.utils.Util;
|
||||
import net.ess3.utils.textreader.*;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
|
||||
public class Commandhelp extends EssentialsCommand
|
||||
|
@@ -1,11 +1,11 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.logging.Level;
|
||||
import org.bukkit.entity.Player;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.utils.FormatUtil;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class Commandhelpop extends EssentialsCommand
|
||||
|
@@ -1,16 +1,16 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
import static net.ess3.I18n._;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.economy.Trade;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.utils.Util;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
|
||||
|
||||
public class Commandhome extends EssentialsCommand
|
||||
@@ -99,8 +99,8 @@ public class Commandhome extends EssentialsCommand
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
if (user.getPlayer().getWorld() != loc.getWorld() && ess.getSettings().getData().getGeneral().isWorldHomePermissions()
|
||||
&& !Permissions.WORLD.isAuthorized(user, loc.getWorld().getName()))
|
||||
if (user.getPlayer().getWorld() != loc.getWorld() && ess.getSettings().getData().getGeneral().isWorldHomePermissions() && !Permissions.WORLD.isAuthorized(
|
||||
user, loc.getWorld().getName()))
|
||||
{
|
||||
throw new Exception(_("noPerm", "essentials.world." + loc.getWorld().getName()));
|
||||
}
|
||||
|
@@ -15,17 +15,23 @@ public class Commandignore extends EssentialsCommand
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
IUser player;
|
||||
try {
|
||||
try
|
||||
{
|
||||
player = ess.getUserMap().matchUserExcludingHidden(args[0], user.getPlayer());
|
||||
} catch(Exception e) {
|
||||
if (args[0].equalsIgnoreCase("list")) {
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("list"))
|
||||
{
|
||||
user.sendMessage(Util.joinList(user.getData().getIgnore()));
|
||||
throw new NoChargeException();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (user.isIgnoringPlayer(player))
|
||||
{
|
||||
user.setIgnoredPlayer(player, false);
|
||||
|
@@ -1,10 +1,10 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import net.ess3.utils.textreader.IText;
|
||||
import net.ess3.utils.textreader.KeywordReplacer;
|
||||
import net.ess3.utils.textreader.TextInput;
|
||||
import net.ess3.utils.textreader.TextPager;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
public class Commandinfo extends EssentialsCommand
|
||||
|
@@ -1,11 +1,10 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import java.util.Arrays;
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.Arrays;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.user.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
|
||||
public class Commandinvsee extends EssentialsCommand
|
||||
|
@@ -1,12 +1,12 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
|
||||
|
||||
public class Commanditem extends EssentialsCommand
|
||||
|
@@ -1,12 +1,10 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IUser;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.ess3.api.IUser;
|
||||
|
||||
|
||||
public class Commanditemdb extends EssentialsCommand
|
||||
|
@@ -1,9 +1,8 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import net.ess3.utils.Util;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import net.ess3.utils.Util;
|
||||
|
||||
|
||||
public class Commandjails extends EssentialsCommand
|
||||
|
@@ -1,11 +1,11 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.economy.Trade;
|
||||
import net.ess3.utils.LocationUtil;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
|
||||
|
||||
public class Commandjump extends EssentialsCommand
|
||||
|
@@ -1,11 +1,11 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import net.ess3.Console;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import net.ess3.Console;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
|
||||
|
||||
public class Commandkick extends EssentialsCommand
|
||||
|
@@ -1,9 +1,9 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IUser;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import net.ess3.api.IUser;
|
||||
|
||||
|
||||
public class Commandkickall extends EssentialsCommand
|
||||
|
@@ -1,11 +1,11 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
|
||||
|
||||
public class Commandkill extends EssentialsCommand
|
||||
@@ -21,7 +21,9 @@ public class Commandkill extends EssentialsCommand
|
||||
for (IUser matchPlayer : ess.getUserMap().matchUsersExcludingHidden(args[0], getPlayerOrNull(sender)))
|
||||
{
|
||||
final Player player = matchPlayer.getPlayer();
|
||||
final EntityDamageEvent ede = new EntityDamageEvent(player, sender instanceof IUser && sender.getName().equals(matchPlayer.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, Short.MAX_VALUE);
|
||||
final EntityDamageEvent ede = new EntityDamageEvent(
|
||||
player, sender instanceof IUser && sender.getName().equals(
|
||||
matchPlayer.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, Short.MAX_VALUE);
|
||||
server.getPluginManager().callEvent(ede);
|
||||
if (ede.isCancelled() && Permissions.KILL_FORCE.isAuthorized(sender))
|
||||
{
|
||||
|
@@ -1,9 +1,8 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.Collections;
|
||||
import java.util.Locale;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.bukkit.LivingEntities;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
@@ -11,6 +10,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import net.ess3.bukkit.LivingEntities;
|
||||
|
||||
|
||||
public class Commandkillall extends EssentialsCommand
|
||||
@@ -117,7 +117,7 @@ public class Commandkillall extends EssentialsCommand
|
||||
{
|
||||
if (entity instanceof Animals || entity instanceof NPC || entity instanceof Snowman || entity instanceof WaterMob)
|
||||
{
|
||||
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.<ItemStack> emptyList());
|
||||
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.<ItemStack>emptyList());
|
||||
ess.getServer().getPluginManager().callEvent(event);
|
||||
entity.remove();
|
||||
numKills++;
|
||||
@@ -127,7 +127,7 @@ public class Commandkillall extends EssentialsCommand
|
||||
{
|
||||
if (entity instanceof Monster || entity instanceof ComplexLivingEntity || entity instanceof Flying || entity instanceof Slime)
|
||||
{
|
||||
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.<ItemStack> emptyList());
|
||||
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.<ItemStack>emptyList());
|
||||
ess.getServer().getPluginManager().callEvent(event);
|
||||
entity.remove();
|
||||
numKills++;
|
||||
@@ -135,14 +135,14 @@ public class Commandkillall extends EssentialsCommand
|
||||
}
|
||||
else if (all)
|
||||
{
|
||||
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.<ItemStack> emptyList());
|
||||
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.<ItemStack>emptyList());
|
||||
ess.getServer().getPluginManager().callEvent(event);
|
||||
entity.remove();
|
||||
numKills++;
|
||||
}
|
||||
else if (entityClass != null && entityClass.isAssignableFrom(entity.getClass()))
|
||||
{
|
||||
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.<ItemStack> emptyList());
|
||||
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.<ItemStack>emptyList());
|
||||
ess.getServer().getPluginManager().callEvent(event);
|
||||
entity.remove();
|
||||
numKills++;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.economy.Trade;
|
||||
import net.ess3.permissions.Permissions;
|
||||
@@ -51,7 +51,7 @@ public class Commandkit extends EssentialsCommand
|
||||
charge.isAffordableFor(user);
|
||||
|
||||
ess.getKits().sendKit(user, kit);
|
||||
|
||||
|
||||
//TODO: Merge kit changes from 2.9
|
||||
|
||||
charge.charge(user);
|
||||
|
@@ -1,12 +1,12 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.ISettings;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.LightningStrike;
|
||||
import org.bukkit.entity.Player;
|
||||
import net.ess3.api.ISettings;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
|
||||
|
||||
public class Commandlightning extends EssentialsCommand
|
||||
|
@@ -1,13 +1,13 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import java.util.*;
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.*;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import net.ess3.api.ISettings;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.utils.FormatUtil;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class Commandlist extends EssentialsCommand
|
||||
@@ -59,8 +59,7 @@ public class Commandlist extends EssentialsCommand
|
||||
final Set<String> hiddenPlayers = new HashSet<String>();
|
||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||
{
|
||||
if (userPlayer != null
|
||||
&& !userPlayer.canSee(onlinePlayer))
|
||||
if (userPlayer != null && !userPlayer.canSee(onlinePlayer))
|
||||
{
|
||||
hiddenPlayers.add(onlinePlayer.getName());
|
||||
if (!showhidden)
|
||||
@@ -118,8 +117,7 @@ public class Commandlist extends EssentialsCommand
|
||||
final Set<String> hiddenPlayers = new HashSet<String>();
|
||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||
{
|
||||
if (userPlayer != null
|
||||
&& !userPlayer.canSee(onlinePlayer))
|
||||
if (userPlayer != null && !userPlayer.canSee(onlinePlayer))
|
||||
{
|
||||
hiddenPlayers.add(onlinePlayer.getName());
|
||||
if (!showhidden)
|
||||
|
@@ -1,12 +1,12 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import java.util.List;
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.List;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.utils.FormatUtil;
|
||||
import net.ess3.utils.Util;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
public class Commandmail extends EssentialsCommand
|
||||
|
@@ -1,16 +1,15 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import java.util.Locale;
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import net.ess3.api.ChargeException;
|
||||
import net.ess3.api.ISettings;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.economy.Trade;
|
||||
import net.ess3.permissions.Permissions;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
public class Commandmore extends EssentialsCommand
|
||||
{
|
||||
@@ -25,9 +24,8 @@ public class Commandmore extends EssentialsCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
stacks = new ItemStack[]
|
||||
{
|
||||
player.getItemInHand()
|
||||
stacks = new ItemStack[]{
|
||||
player.getItemInHand()
|
||||
};
|
||||
}
|
||||
for (ItemStack stack : stacks)
|
||||
@@ -48,9 +46,8 @@ public class Commandmore extends EssentialsCommand
|
||||
final int defaultStackSize = settings.getData().getGeneral().getDefaultStacksize();
|
||||
final int oversizedStackSize = settings.getData().getGeneral().getOversizedStacksize();
|
||||
|
||||
int newAmount = Permissions.OVERSIZEDSTACKS.isAuthorized(user)
|
||||
? oversizedStackSize
|
||||
: defaultStackSize > 0 ? defaultStackSize : stack.getMaxStackSize();
|
||||
int newAmount = Permissions.OVERSIZEDSTACKS.isAuthorized(
|
||||
user) ? oversizedStackSize : defaultStackSize > 0 ? defaultStackSize : stack.getMaxStackSize();
|
||||
if (stack.getAmount() >= newAmount)
|
||||
{
|
||||
if (stacks.length == 1)
|
||||
|
@@ -1,10 +1,10 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import net.ess3.utils.textreader.IText;
|
||||
import net.ess3.utils.textreader.KeywordReplacer;
|
||||
import net.ess3.utils.textreader.TextInput;
|
||||
import net.ess3.utils.textreader.TextPager;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
public class Commandmotd extends EssentialsCommand
|
||||
|
@@ -1,14 +1,14 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import java.util.Set;
|
||||
import net.ess3.Console;
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.Set;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import net.ess3.Console;
|
||||
import net.ess3.api.IReplyTo;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.utils.FormatUtil;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class Commandmsg extends EssentialsCommand
|
||||
@@ -57,7 +57,7 @@ public class Commandmsg extends EssentialsCommand
|
||||
Console.getConsoleReplyTo().setReplyTo(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
final Set<IUser> matchedPlayers = ess.getUserMap().matchUsers(args[0], false);
|
||||
|
||||
@@ -70,7 +70,7 @@ public class Commandmsg extends EssentialsCommand
|
||||
if (isUser(sender))
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
|
||||
for (IUser u : matchedPlayers)
|
||||
{
|
||||
if (!player.canSee(u.getPlayer()))
|
||||
|
@@ -1,11 +1,11 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.user.UserData.TimestampType;
|
||||
import net.ess3.utils.DateUtil;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
public class Commandmute extends EssentialsCommand
|
||||
@@ -38,16 +38,10 @@ public class Commandmute extends EssentialsCommand
|
||||
player.setTimestamp(TimestampType.MUTE, muteTimestamp);
|
||||
final boolean muted = player.getData().isMuted();
|
||||
sender.sendMessage(
|
||||
muted
|
||||
? (muteTimestamp > 0
|
||||
? _("mutedPlayerFor", player.getPlayer().getDisplayName(), DateUtil.formatDateDiff(muteTimestamp))
|
||||
: _("mutedPlayer", player.getPlayer().getDisplayName()))
|
||||
: _("unmutedPlayer", player.getPlayer().getDisplayName()));
|
||||
muted ? (muteTimestamp > 0 ? _("mutedPlayerFor", player.getPlayer().getDisplayName(), DateUtil.formatDateDiff(muteTimestamp)) : _(
|
||||
"mutedPlayer", player.getPlayer().getDisplayName())) : _(
|
||||
"unmutedPlayer", player.getPlayer().getDisplayName()));
|
||||
player.sendMessage(
|
||||
muted
|
||||
? (muteTimestamp > 0
|
||||
? _("playerMutedFor", DateUtil.formatDateDiff(muteTimestamp))
|
||||
: _("playerMuted"))
|
||||
: _("playerUnmuted"));
|
||||
muted ? (muteTimestamp > 0 ? _("playerMutedFor", DateUtil.formatDateDiff(muteTimestamp)) : _("playerMuted")) : _("playerUnmuted"));
|
||||
}
|
||||
}
|
||||
|
@@ -1,12 +1,12 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
|
||||
|
||||
public class Commandnear extends EssentialsCommand
|
||||
|
@@ -1,14 +1,14 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import java.util.Locale;
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import net.ess3.api.ISettings;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.utils.FormatUtil;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class Commandnick extends EssentialsCommand
|
||||
|
@@ -5,7 +5,6 @@ import net.ess3.api.IUser;
|
||||
import net.ess3.economy.Trade;
|
||||
|
||||
|
||||
|
||||
public class Commandpay extends EssentialsCommand
|
||||
{
|
||||
@Override
|
||||
@@ -17,8 +16,9 @@ public class Commandpay extends EssentialsCommand
|
||||
}
|
||||
|
||||
final double amount = Double.parseDouble(args[1].replaceAll("[^0-9\\.]", ""));
|
||||
|
||||
if (amount <= 0 || Double.isNaN(amount) || Double.isInfinite(amount)) {
|
||||
|
||||
if (amount <= 0 || Double.isNaN(amount) || Double.isInfinite(amount))
|
||||
{
|
||||
user.sendMessage(_("invalidAmount"));
|
||||
}
|
||||
|
||||
@@ -26,7 +26,9 @@ public class Commandpay extends EssentialsCommand
|
||||
for (IUser u : ess.getUserMap().matchUsers(args[0], true))
|
||||
{
|
||||
user.payUser(u, amount);
|
||||
Trade.log("Command", "Pay", "Player", user.getName(), new Trade(amount, ess), u.getName(), new Trade(amount, ess), user.getPlayer().getLocation(), ess);
|
||||
Trade.log(
|
||||
"Command", "Pay", "Player", user.getName(), new Trade(amount, ess), u.getName(), new Trade(amount, ess), user.getPlayer().getLocation(),
|
||||
ess);
|
||||
foundUser = true;
|
||||
}
|
||||
|
||||
|
@@ -1,15 +1,15 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import static net.ess3.I18n._;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.user.UserData;
|
||||
import net.ess3.utils.Util;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
public class Commandpowertool extends EssentialsCommand
|
||||
@@ -57,7 +57,7 @@ public class Commandpowertool extends EssentialsCommand
|
||||
{
|
||||
throw new Exception(_("powerToolNoSuchCommandAssigned", command, itemName));
|
||||
}
|
||||
|
||||
|
||||
powertools = new ArrayList<String>(powertools);
|
||||
powertools.remove(command);
|
||||
user.sendMessage(_("powerToolRemove", command, itemName));
|
||||
|
@@ -18,8 +18,7 @@ public class Commandpowertooltoggle extends EssentialsCommand
|
||||
}
|
||||
userData.setPowerToolsEnabled(!userData.isPowerToolsEnabled());
|
||||
user.queueSave();
|
||||
user.sendMessage(userData.isPowerToolsEnabled()
|
||||
? _("powerToolsEnabled")
|
||||
: _("powerToolsDisabled"));
|
||||
user.sendMessage(
|
||||
userData.isPowerToolsEnabled() ? _("powerToolsEnabled") : _("powerToolsDisabled"));
|
||||
}
|
||||
}
|
||||
|
@@ -1,19 +1,19 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import java.util.*;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.utils.DescParseTickFormat;
|
||||
import java.util.*;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.utils.DescParseTickFormat;
|
||||
|
||||
|
||||
public class Commandptime extends EssentialsCommand
|
||||
{
|
||||
public static final Set<String> getAliases = new HashSet<String>();
|
||||
|
||||
|
||||
static
|
||||
{
|
||||
getAliases.add("get");
|
||||
@@ -21,7 +21,7 @@ public class Commandptime extends EssentialsCommand
|
||||
getAliases.add("show");
|
||||
getAliases.add("display");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
@@ -39,14 +39,14 @@ public class Commandptime extends EssentialsCommand
|
||||
getUsersTime(sender, users);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
IUser user = isUser(sender) ? getUser(sender) : null;
|
||||
if ((!users.contains(user) || users.size() > 1) && user != null && !Permissions.PTIME_OTHERS.isAuthorized(user))
|
||||
{
|
||||
user.sendMessage(_("pTimeOthersPermission"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Long ticks;
|
||||
// Parse the target time int ticks from args[0]
|
||||
String timeParam = args[0];
|
||||
@@ -56,7 +56,7 @@ public class Commandptime extends EssentialsCommand
|
||||
relative = false;
|
||||
timeParam = timeParam.substring(1);
|
||||
}
|
||||
|
||||
|
||||
if (getAliases.contains(timeParam))
|
||||
{
|
||||
getUsersTime(sender, users);
|
||||
@@ -77,7 +77,7 @@ public class Commandptime extends EssentialsCommand
|
||||
throw new NotEnoughArgumentsException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
setUsersTime(sender, users, ticks, relative);
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ public class Commandptime extends EssentialsCommand
|
||||
{
|
||||
sender.sendMessage(_("pTimePlayers"));
|
||||
}
|
||||
|
||||
|
||||
for (IUser user : users)
|
||||
{
|
||||
if (user.getPlayer().getPlayerTimeOffset() == 0)
|
||||
@@ -143,7 +143,7 @@ public class Commandptime extends EssentialsCommand
|
||||
user.getPlayer().setPlayerTime(time, relative);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
final StringBuilder msg = new StringBuilder();
|
||||
for (IUser user : users)
|
||||
{
|
||||
@@ -151,7 +151,7 @@ public class Commandptime extends EssentialsCommand
|
||||
{
|
||||
msg.append(", ");
|
||||
}
|
||||
|
||||
|
||||
msg.append(user.getName());
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ public class Commandptime extends EssentialsCommand
|
||||
{
|
||||
user = ess.getUserMap().getUser(matchedPlayers.get(0));
|
||||
}
|
||||
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
users.add(user);
|
||||
@@ -223,7 +223,7 @@ public class Commandptime extends EssentialsCommand
|
||||
{
|
||||
throw new Exception(_("playerNotFound"));
|
||||
}
|
||||
|
||||
|
||||
return users;
|
||||
}
|
||||
}
|
||||
|
@@ -1,12 +1,12 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import net.ess3.Console;
|
||||
import static net.ess3.I18n._;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import net.ess3.Console;
|
||||
import net.ess3.api.IReplyTo;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.utils.FormatUtil;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
public class Commandr extends EssentialsCommand
|
||||
|
@@ -1,12 +1,12 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import java.util.Locale;
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.api.IUserMap;
|
||||
import net.ess3.utils.FormatUtil;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class Commandrealname extends EssentialsCommand
|
||||
|
@@ -1,17 +1,16 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.utils.Util;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.inventory.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.inventory.*;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.utils.Util;
|
||||
|
||||
|
||||
public class Commandrecipe extends EssentialsCommand
|
||||
{
|
||||
@@ -49,15 +48,15 @@ public class Commandrecipe extends EssentialsCommand
|
||||
sender.sendMessage(_("recipe", getMaterialName(item), recipeNo + 1, recipes.size()));
|
||||
if (recipe instanceof FurnaceRecipe)
|
||||
{
|
||||
furnaceRecipe(sender, (FurnaceRecipe) recipe);
|
||||
furnaceRecipe(sender, (FurnaceRecipe)recipe);
|
||||
}
|
||||
else if (recipe instanceof ShapedRecipe)
|
||||
{
|
||||
shapedRecipe(sender, (ShapedRecipe) recipe);
|
||||
shapedRecipe(sender, (ShapedRecipe)recipe);
|
||||
}
|
||||
else if (recipe instanceof ShapelessRecipe)
|
||||
{
|
||||
shapelessRecipe(sender, (ShapelessRecipe) recipe);
|
||||
shapelessRecipe(sender, (ShapelessRecipe)recipe);
|
||||
}
|
||||
if (recipes.size() > 1 && args.length == 1)
|
||||
{
|
||||
|
@@ -1,12 +1,13 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import java.util.Locale;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IUser;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.*;
|
||||
import net.ess3.api.IUser;
|
||||
|
||||
|
||||
//Todo: Fix this up
|
||||
public class Commandremove extends EssentialsCommand
|
||||
@@ -88,7 +89,7 @@ public class Commandremove extends EssentialsCommand
|
||||
{
|
||||
radius *= radius;
|
||||
}
|
||||
|
||||
|
||||
for (Chunk chunk : world.getLoadedChunks())
|
||||
{
|
||||
for (Entity e : chunk.getEntities())
|
||||
@@ -100,49 +101,50 @@ public class Commandremove extends EssentialsCommand
|
||||
continue;
|
||||
}
|
||||
}
|
||||
switch (toRemove) {
|
||||
case DROPS:
|
||||
if (e instanceof Item)
|
||||
{
|
||||
e.remove();
|
||||
removed++;
|
||||
}
|
||||
break;
|
||||
case ARROWS:
|
||||
if (e instanceof Projectile)
|
||||
{
|
||||
e.remove();
|
||||
removed++;
|
||||
}
|
||||
break;
|
||||
case BOATS:
|
||||
if (e instanceof Boat)
|
||||
{
|
||||
e.remove();
|
||||
removed++;
|
||||
}
|
||||
break;
|
||||
case MINECARTS:
|
||||
if (e instanceof Minecart)
|
||||
{
|
||||
e.remove();
|
||||
removed++;
|
||||
}
|
||||
break;
|
||||
case PAINTINGS:
|
||||
if (e instanceof Painting)
|
||||
{
|
||||
e.remove();
|
||||
removed++;
|
||||
}
|
||||
break;
|
||||
case XP:
|
||||
if (e instanceof ExperienceOrb)
|
||||
{
|
||||
e.remove();
|
||||
removed++;
|
||||
}
|
||||
break;
|
||||
switch (toRemove)
|
||||
{
|
||||
case DROPS:
|
||||
if (e instanceof Item)
|
||||
{
|
||||
e.remove();
|
||||
removed++;
|
||||
}
|
||||
break;
|
||||
case ARROWS:
|
||||
if (e instanceof Projectile)
|
||||
{
|
||||
e.remove();
|
||||
removed++;
|
||||
}
|
||||
break;
|
||||
case BOATS:
|
||||
if (e instanceof Boat)
|
||||
{
|
||||
e.remove();
|
||||
removed++;
|
||||
}
|
||||
break;
|
||||
case MINECARTS:
|
||||
if (e instanceof Minecart)
|
||||
{
|
||||
e.remove();
|
||||
removed++;
|
||||
}
|
||||
break;
|
||||
case PAINTINGS:
|
||||
if (e instanceof Painting)
|
||||
{
|
||||
e.remove();
|
||||
removed++;
|
||||
}
|
||||
break;
|
||||
case XP:
|
||||
if (e instanceof ExperienceOrb)
|
||||
{
|
||||
e.remove();
|
||||
removed++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,16 +1,16 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import static net.ess3.I18n._;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import net.ess3.api.ChargeException;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.economy.Trade;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.utils.Util;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
public class Commandrepair extends EssentialsCommand
|
||||
@@ -31,8 +31,7 @@ public class Commandrepair extends EssentialsCommand
|
||||
throw new Exception(_("repairInvalidType"));
|
||||
}
|
||||
|
||||
if (!item.getEnchantments().isEmpty()
|
||||
&& !Permissions.REPAIR_ENCHANTED.isAuthorized(user))
|
||||
if (!item.getEnchantments().isEmpty() && !Permissions.REPAIR_ENCHANTED.isAuthorized(user))
|
||||
{
|
||||
throw new Exception(_("repairEnchanted"));
|
||||
}
|
||||
@@ -112,8 +111,7 @@ public class Commandrepair extends EssentialsCommand
|
||||
user.sendMessage(ex.getMessage());
|
||||
continue;
|
||||
}
|
||||
if (!item.getEnchantments().isEmpty()
|
||||
&& !Permissions.REPAIR_ENCHANTED.isAuthorized(user))
|
||||
if (!item.getEnchantments().isEmpty() && !Permissions.REPAIR_ENCHANTED.isAuthorized(user))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@@ -1,10 +1,10 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import net.ess3.utils.textreader.IText;
|
||||
import net.ess3.utils.textreader.KeywordReplacer;
|
||||
import net.ess3.utils.textreader.TextInput;
|
||||
import net.ess3.utils.textreader.TextPager;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
public class Commandrules extends EssentialsCommand
|
||||
|
@@ -1,28 +1,29 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.user.PlayerNotFoundException;
|
||||
import net.ess3.user.UserData.TimestampType;
|
||||
import net.ess3.utils.DateUtil;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
public class Commandseen extends EssentialsCommand
|
||||
{
|
||||
@Override
|
||||
protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
seen(sender,args,true);
|
||||
seen(sender, args, true);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void run(final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
seen(user,args,Permissions.SEEN_BANREASON.isAuthorized(user));
|
||||
seen(user, args, Permissions.SEEN_BANREASON.isAuthorized(user));
|
||||
}
|
||||
|
||||
protected void seen (final CommandSender sender, final String[] args, final boolean show) throws Exception
|
||||
|
||||
protected void seen(final CommandSender sender, final String[] args, final boolean show) throws Exception
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
@@ -30,7 +31,7 @@ public class Commandseen extends EssentialsCommand
|
||||
}
|
||||
try
|
||||
{
|
||||
final IUser u = ess.getUserMap().matchUserExcludingHidden(args[0], getPlayerOrNull(sender));
|
||||
final IUser u = ess.getUserMap().matchUserExcludingHidden(args[0], getPlayerOrNull(sender));
|
||||
sender.sendMessage(_("seenOnline", u.getPlayer().getDisplayName(), DateUtil.formatDateDiff(u.getTimestamp(TimestampType.LOGIN))));
|
||||
}
|
||||
catch (PlayerNotFoundException e)
|
||||
|
@@ -1,16 +1,15 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.Locale;
|
||||
import java.util.logging.Level;
|
||||
import static net.ess3.I18n._;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.craftbukkit.InventoryWorkaround;
|
||||
import net.ess3.economy.Trade;
|
||||
import net.ess3.utils.FormatUtil;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
|
||||
public class Commandsell extends EssentialsCommand
|
||||
@@ -140,7 +139,7 @@ public class Commandsell extends EssentialsCommand
|
||||
}
|
||||
|
||||
final Player player = user.getPlayer();
|
||||
|
||||
|
||||
//TODO: Prices for Enchantments
|
||||
final ItemStack ris = is.clone();
|
||||
ris.setAmount(amount);
|
||||
@@ -148,8 +147,14 @@ public class Commandsell extends EssentialsCommand
|
||||
player.updateInventory();
|
||||
Trade.log("Command", "Sell", "Item", user.getName(), new Trade(ris, ess), user.getName(), new Trade(worth * amount, ess), player.getLocation(), ess);
|
||||
user.giveMoney(worth * amount);
|
||||
user.sendMessage(_("itemSold", FormatUtil.displayCurrency(worth * amount, ess), amount, is.getType().toString().toLowerCase(Locale.ENGLISH), FormatUtil.displayCurrency(worth, ess)));
|
||||
logger.log(Level.INFO, _("itemSoldConsole", player.getDisplayName(), is.getType().toString().toLowerCase(Locale.ENGLISH), FormatUtil.displayCurrency(worth * amount, ess), amount, FormatUtil.displayCurrency(worth, ess)));
|
||||
user.sendMessage(
|
||||
_(
|
||||
"itemSold", FormatUtil.displayCurrency(worth * amount, ess), amount, is.getType().toString().toLowerCase(Locale.ENGLISH),
|
||||
FormatUtil.displayCurrency(worth, ess)));
|
||||
logger.log(
|
||||
Level.INFO, _(
|
||||
"itemSoldConsole", player.getDisplayName(), is.getType().toString().toLowerCase(Locale.ENGLISH),
|
||||
FormatUtil.displayCurrency(worth * amount, ess), amount, FormatUtil.displayCurrency(worth, ess)));
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
|
||||
@@ -31,8 +31,7 @@ public class Commandsethome extends EssentialsCommand
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
if ((user.getHomes().size() < ess.getRanks().getHomeLimit(user))
|
||||
|| (user.getHomes().contains(args[0].toLowerCase(Locale.ENGLISH))))
|
||||
if ((user.getHomes().size() < ess.getRanks().getHomeLimit(user)) || (user.getHomes().contains(args[0].toLowerCase(Locale.ENGLISH))))
|
||||
{
|
||||
user.getData().addHome(args[0].toLowerCase(Locale.ENGLISH), user.getPlayer().getLocation());
|
||||
user.queueSave();
|
||||
@@ -77,7 +76,10 @@ public class Commandsethome extends EssentialsCommand
|
||||
user.getData().addHome("home", user.getPlayer().getLocation());
|
||||
user.queueSave();
|
||||
}
|
||||
user.sendMessage(_("homeSet", user.getPlayer().getLocation().getWorld().getName(), user.getPlayer().getLocation().getBlockX(), user.getPlayer().getLocation().getBlockY(), user.getPlayer().getLocation().getBlockZ()));
|
||||
user.sendMessage(
|
||||
_(
|
||||
"homeSet", user.getPlayer().getLocation().getWorld().getName(), user.getPlayer().getLocation().getBlockX(),
|
||||
user.getPlayer().getLocation().getBlockY(), user.getPlayer().getLocation().getBlockZ()));
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -1,13 +1,11 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import org.bukkit.Location;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.api.IWarps;
|
||||
import net.ess3.permissions.Permissions;
|
||||
import net.ess3.utils.Util;
|
||||
import org.bukkit.Location;
|
||||
|
||||
|
||||
|
||||
|
||||
public class Commandsetwarp extends EssentialsCommand
|
||||
@@ -38,7 +36,7 @@ public class Commandsetwarp extends EssentialsCommand
|
||||
}
|
||||
|
||||
if (warpLoc == null || Permissions.WARP_OVERWRITE.isAuthorized(user, args[0]))
|
||||
|
||||
|
||||
{
|
||||
warps.setWarp(args[0], loc);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user