mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-08 15:46:54 +02:00
2.9 -> 3.0 merge
Commented out a load of metrics code for the time being
This commit is contained in:
@@ -97,13 +97,13 @@ public class Kits extends AsyncStorageObjectHolder<com.earth2me.essentials.setti
|
||||
@Override
|
||||
public void finishRead()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishWrite()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
|
||||
}
|
||||
|
||||
public void checkTime(final IUser user, Kit kit) throws NoChargeException
|
||||
|
@@ -3,6 +3,7 @@ package com.earth2me.essentials.api;
|
||||
import com.earth2me.essentials.EssentialsTimer;
|
||||
import com.earth2me.essentials.economy.register.Methods;
|
||||
import com.earth2me.essentials.listener.TntExplodeListener;
|
||||
import com.earth2me.essentials.metrics.Metrics;
|
||||
import java.util.List;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@@ -64,4 +65,8 @@ public interface IEssentials extends Plugin
|
||||
List<String> getVanishedPlayers();
|
||||
|
||||
EssentialsTimer getTimer();
|
||||
|
||||
Metrics getMetrics();
|
||||
|
||||
void setMetrics(Metrics metrics);
|
||||
}
|
||||
|
@@ -120,4 +120,6 @@ public interface IUser extends Player, IStorageObjectHolder<UserData>, IReload,
|
||||
|
||||
void setInvSee(boolean invsee);
|
||||
|
||||
void update(final Player base);
|
||||
|
||||
}
|
||||
|
@@ -13,7 +13,7 @@ public class Commandback extends EssentialsCommand
|
||||
{
|
||||
final String worldName = user.getData().getLastLocation().getWorldName();
|
||||
if (user.getWorld() != user.getData().getLastLocation().getBukkitLocation().getWorld() && ess.getSettings().getData().getGeneral().isWorldTeleportPermissions()
|
||||
&& WorldPermissions.getPermission(worldName))
|
||||
&& WorldPermissions.getPermission(worldName).isAuthorized(user))
|
||||
{
|
||||
throw new Exception(_("noPerm", "essentials.world." + worldName));
|
||||
}
|
||||
|
@@ -2,6 +2,8 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.IBackup;
|
||||
import com.earth2me.essentials.api.ISettings;
|
||||
import lombok.Cleanup;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
@@ -15,7 +17,11 @@ public class Commandbackup extends EssentialsCommand
|
||||
{
|
||||
throw new Exception(_("backupDisabled"));
|
||||
}
|
||||
final String command = ess.getSettings().getData().getCommands().getBackupCommand();
|
||||
|
||||
@Cleanup
|
||||
ISettings settings = ess.getSettings();
|
||||
settings.acquireReadLock();
|
||||
final String command = settings.getData().getGeneral().getBackup().getCommand();
|
||||
if (command == null || "".equals(command) || "save-all".equalsIgnoreCase(command))
|
||||
{
|
||||
throw new Exception(_("backupDisabled"));
|
||||
|
@@ -1,9 +1,9 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.utils.Util;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import com.earth2me.essentials.utils.Util;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ public class Commandbalance extends EssentialsCommand
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
sender.sendMessage(_("balance", Util.displayCurrency(getPlayer(server, args, 0, true).getMoney(), ess)));
|
||||
sender.sendMessage(_("balance", Util.displayCurrency(getPlayer(args, 0, true).getMoney(), ess)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -25,7 +25,7 @@ public class Commandbalance extends EssentialsCommand
|
||||
final double bal = (args.length < 1
|
||||
|| !Permissions.BALANCE_OTHERS.isAuthorized(user)
|
||||
? user
|
||||
: getPlayer(server, args, 0, true)).getMoney();
|
||||
: getPlayer(args, 0, true)).getMoney();
|
||||
user.sendMessage(_("balance", Util.displayCurrency(bal, ess)));
|
||||
}
|
||||
}
|
||||
|
@@ -12,13 +12,13 @@ public class MoneyHolder extends AsyncStorageObjectHolder<Money>
|
||||
@Override
|
||||
public void finishRead()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishWrite()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -19,13 +19,13 @@ public class WorthHolder extends AsyncStorageObjectHolder<com.earth2me.essential
|
||||
@Override
|
||||
public void finishRead()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishWrite()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -27,7 +27,7 @@ public class MetricsListener implements Listener
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerJoin(final PlayerJoinEvent event)
|
||||
{
|
||||
final IUser player = ess.getUser(event.getPlayer());
|
||||
/*final IUser player = ess.getUser(event.getPlayer());
|
||||
if (ess.getSettings().isMetricsEnabled() == false && (player.isAuthorized("essentials.essentials") || player.isAuthorized("bukkit.broadcast.admin")))
|
||||
{
|
||||
player.sendMessage("PluginMetrics collects minimal statistic data, starting in about 5 minutes.");
|
||||
@@ -35,6 +35,6 @@ public class MetricsListener implements Listener
|
||||
ess.getLogger().log(Level.INFO, "[Metrics] Admin join - Starting 5 minute opt-out period.");
|
||||
ess.getSettings().setMetricsEnabled(true);
|
||||
ess.getScheduler().scheduleAsyncDelayedTask(ess, starter, 5 * 1200);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
@@ -1,12 +1,18 @@
|
||||
package com.earth2me.essentials.metrics;
|
||||
|
||||
import com.earth2me.essentials.api.IEssentials;
|
||||
import com.earth2me.essentials.api.ISettings;
|
||||
import com.earth2me.essentials.economy.register.Method;
|
||||
import com.earth2me.essentials.economy.register.methods.VaultEco;
|
||||
import com.earth2me.essentials.metrics.Metrics.Graph;
|
||||
import com.earth2me.essentials.metrics.Metrics.Plotter;
|
||||
import com.earth2me.essentials.register.payment.Method;
|
||||
import com.earth2me.essentials.register.payment.methods.VaultEco;
|
||||
//import com.earth2me.essentials.register.payment.Method;
|
||||
//import com.earth2me.essentials.register.payment.methods.VaultEco;
|
||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||
import java.util.Locale;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import lombok.Cleanup;
|
||||
|
||||
|
||||
public class MetricsStarter implements Runnable
|
||||
@@ -29,32 +35,36 @@ public class MetricsStarter implements Runnable
|
||||
public MetricsStarter(final IEssentials plugin)
|
||||
{
|
||||
ess = plugin;
|
||||
try
|
||||
{
|
||||
/*
|
||||
try
|
||||
{
|
||||
|
||||
final Metrics metrics = new Metrics(ess);
|
||||
ess.setMetrics(metrics);
|
||||
final Metrics metrics = new Metrics(ess);
|
||||
ess.setMetrics(metrics);
|
||||
|
||||
if (!metrics.isOptOut())
|
||||
{
|
||||
if (ess.getSettings().isMetricsEnabled())
|
||||
{
|
||||
start = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ess.getLogger().info("This plugin collects minimal statistic data and sends it to http://metrics.essentials3.net.");
|
||||
ess.getLogger().info("You can opt out by running /essentials opt-out");
|
||||
ess.getLogger().info("This will start 5 minutes after the first admin/op joins.");
|
||||
start = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
metricsError(ex);
|
||||
}
|
||||
@Cleanup
|
||||
ISettings settings = ess.getSettings();
|
||||
settings.acquireReadLock();
|
||||
if (!metrics.isOptOut())
|
||||
{
|
||||
if (settings.getData().getGeneral().isMetricsEnabled())
|
||||
{
|
||||
start = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ess.getLogger().info("This plugin collects minimal statistic data and sends it to http://metrics.essentials3.net.");
|
||||
ess.getLogger().info("You can opt out by running /essentials opt-out");
|
||||
ess.getLogger().info("This will start 5 minutes after the first admin/op joins.");
|
||||
start = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
metricsError(ex);
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -99,7 +109,16 @@ public class MetricsStarter implements Runnable
|
||||
@Override
|
||||
public int getValue()
|
||||
{
|
||||
return ess.getSettings().getKits().getKeys(false).size();
|
||||
int size = 0;
|
||||
try
|
||||
{
|
||||
size = ess.getKits().getList().size();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
return size;
|
||||
|
||||
}
|
||||
});
|
||||
featureGraph.addPlotter(new Plotter("Warps")
|
||||
@@ -107,13 +126,16 @@ public class MetricsStarter implements Runnable
|
||||
@Override
|
||||
public int getValue()
|
||||
{
|
||||
return ess.getWarps().getWarpNames().size();
|
||||
return ess.getWarps().getList().size();
|
||||
}
|
||||
});
|
||||
|
||||
final Graph enabledGraph = metrics.createGraph("EnabledFeatures");
|
||||
enabledGraph.addPlotter(new SimplePlotter("Total"));
|
||||
final String BKcommand = ess.getSettings().getBackupCommand();
|
||||
@Cleanup
|
||||
ISettings settings = ess.getSettings();
|
||||
settings.acquireReadLock();
|
||||
final String BKcommand = settings.getData().getGeneral().getBackup().getCommand();;
|
||||
if (BKcommand != null && !"".equals(BKcommand))
|
||||
{
|
||||
enabledGraph.addPlotter(new SimplePlotter("Backup"));
|
||||
@@ -122,31 +144,33 @@ public class MetricsStarter implements Runnable
|
||||
{
|
||||
enabledGraph.addPlotter(new SimplePlotter("Jails"));
|
||||
}
|
||||
if (ess.getSettings().getKits().getKeys(false).size() > 0)
|
||||
if (ess.getKits().getList().size() > 0)
|
||||
{
|
||||
enabledGraph.addPlotter(new SimplePlotter("Kits"));
|
||||
}
|
||||
if (ess.getWarps().getWarpNames().size() > 0)
|
||||
if (ess.getWarps().getList().size() > 0)
|
||||
{
|
||||
enabledGraph.addPlotter(new SimplePlotter("Warps"));
|
||||
}
|
||||
if (!ess.getSettings().areSignsDisabled())
|
||||
{
|
||||
enabledGraph.addPlotter(new SimplePlotter("Signs"));
|
||||
}
|
||||
if (ess.getSettings().getAutoAfk() > 0)
|
||||
{
|
||||
enabledGraph.addPlotter(new SimplePlotter("AutoAFK"));
|
||||
}
|
||||
if (ess.getSettings().changeDisplayName())
|
||||
{
|
||||
enabledGraph.addPlotter(new SimplePlotter("DisplayName"));
|
||||
}
|
||||
if (ess.getSettings().getChatRadius() >= 1)
|
||||
{
|
||||
enabledGraph.addPlotter(new SimplePlotter("LocalChat"));
|
||||
}
|
||||
|
||||
//todo - enable once settings are in
|
||||
/*
|
||||
if (!ess.getSettings().areSignsDisabled())
|
||||
{
|
||||
enabledGraph.addPlotter(new SimplePlotter("Signs"));
|
||||
}
|
||||
if (ess.getSettings().getAutoAfk() > 0)
|
||||
{
|
||||
enabledGraph.addPlotter(new SimplePlotter("AutoAFK"));
|
||||
}
|
||||
if (ess.getSettings().changeDisplayName())
|
||||
{
|
||||
enabledGraph.addPlotter(new SimplePlotter("DisplayName"));
|
||||
}
|
||||
if (ess.getSettings().getChatRadius() >= 1)
|
||||
{
|
||||
enabledGraph.addPlotter(new SimplePlotter("LocalChat"));
|
||||
}
|
||||
*/
|
||||
final Graph depGraph = metrics.createGraph("Dependencies");
|
||||
final Method method = ess.getPaymentMethod().getMethod();
|
||||
if (method != null)
|
||||
@@ -167,7 +191,8 @@ public class MetricsStarter implements Runnable
|
||||
}
|
||||
depGraph.addPlotter(new SimplePlotter(method.getName() + " " + version));
|
||||
}
|
||||
depGraph.addPlotter(new SimplePlotter(ess.getPermissionsHandler().getName()));
|
||||
//todo - verify
|
||||
depGraph.addPlotter(new SimplePlotter(Permissions.getInstance().getName()));
|
||||
|
||||
metrics.start();
|
||||
|
||||
|
@@ -23,13 +23,13 @@ public class RanksStorage extends AsyncStorageObjectHolder<Ranks> implements IRa
|
||||
@Override
|
||||
public void finishRead()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishWrite()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
|
||||
}
|
||||
public RanksStorage(final IEssentials ess)
|
||||
{
|
||||
|
@@ -16,4 +16,5 @@ public class Kit implements StorageObject
|
||||
@ListType(ItemStack.class)
|
||||
private List<ItemStack> items = new ArrayList<ItemStack>();
|
||||
private Double delay;
|
||||
|
||||
}
|
||||
|
@@ -13,13 +13,13 @@ public class SettingsHolder extends AsyncStorageObjectHolder<Settings> implement
|
||||
@Override
|
||||
public void finishRead()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishWrite()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
|
||||
}
|
||||
private final transient AtomicBoolean debug = new AtomicBoolean(false);
|
||||
public SettingsHolder(final IEssentials ess)
|
||||
|
@@ -33,13 +33,13 @@ public class SpawnsHolder extends AsyncStorageObjectHolder<Spawns> implements IE
|
||||
@Override
|
||||
public void finishRead()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishWrite()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
|
||||
}
|
||||
|
||||
public SpawnsHolder(final IEssentials ess)
|
||||
|
@@ -14,13 +14,13 @@ public class WarpHolder extends AsyncStorageObjectHolder<Warp> implements IWarp
|
||||
@Override
|
||||
public void finishRead()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishWrite()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
|
||||
}
|
||||
|
||||
private final String name;
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,7 @@ public class UserData implements StorageObject
|
||||
{
|
||||
public enum TimestampType
|
||||
{
|
||||
JAIL, MUTE, LASTHEAL, LASTTELEPORT, LOGIN, LOGOUT
|
||||
JAIL, MUTE, LASTHEAL, LASTTELEPORT, LOGIN, LOGOUT, KIT
|
||||
}
|
||||
private String nickname;
|
||||
private Double money;
|
||||
|
@@ -189,7 +189,7 @@ public class UtilTest extends TestCase
|
||||
assertEquals("_-", Util.sanitizeFileName("../"));
|
||||
assertEquals("_-", Util.sanitizeFileName("\""));
|
||||
assertEquals("_-", Util.sanitizeFileName("<>?:*."));
|
||||
assertEquals("a-0fa", Util.sanitizeFileName("a<EFBFBD>"));
|
||||
assertEquals("a-0fa", Util.sanitizeFileName("aä"));
|
||||
|
||||
}
|
||||
catch (InvalidNameException ex)
|
||||
|
@@ -23,12 +23,12 @@ public class ProtectHolder extends AsyncStorageObjectHolder<Protect>
|
||||
@Override
|
||||
public void finishRead()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishWrite()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user