mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-28 00:40:05 +02:00
Updated all modules to new api, some settings are still missing
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package com.earth2me.essentials.protect;
|
||||
|
||||
import com.earth2me.essentials.IConf;
|
||||
import com.earth2me.essentials.IEssentials;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.api.IReload;
|
||||
import com.earth2me.essentials.api.IEssentials;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.protect.data.ProtectedBlockMemory;
|
||||
import com.earth2me.essentials.protect.data.ProtectedBlockMySQL;
|
||||
import com.earth2me.essentials.protect.data.ProtectedBlockSQLite;
|
||||
@@ -45,7 +45,7 @@ public class EssentialsConnect
|
||||
return ess;
|
||||
}
|
||||
|
||||
public void alert(final User user, final String item, final String type)
|
||||
public void alert(final IUser user, final String item, final String type)
|
||||
{
|
||||
final Location loc = user.getLocation();
|
||||
final String warnMessage = _("alertFormat", user.getName(), type, item,
|
||||
@@ -54,7 +54,7 @@ public class EssentialsConnect
|
||||
LOGGER.log(Level.WARNING, warnMessage);
|
||||
for (Player p : ess.getServer().getOnlinePlayers())
|
||||
{
|
||||
final User alertUser = ess.getUser(p);
|
||||
final IUser alertUser = ess.getUser(p);
|
||||
if (alertUser.isAuthorized("essentials.protect.alerts"))
|
||||
{
|
||||
alertUser.sendMessage(warnMessage);
|
||||
@@ -63,10 +63,10 @@ public class EssentialsConnect
|
||||
}
|
||||
|
||||
|
||||
private class ProtectReloader implements IConf
|
||||
private class ProtectReloader implements IReload
|
||||
{
|
||||
@Override
|
||||
public void reloadConfig()
|
||||
public void onReload()
|
||||
{
|
||||
if (protect.getStorage() != null)
|
||||
{
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package com.earth2me.essentials.protect;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.IEssentials;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.api.IEssentials;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.protect.data.IProtectedBlock;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -31,7 +31,7 @@ public class EssentialsProtectBlockListener extends BlockListener
|
||||
return;
|
||||
}
|
||||
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
final IUser user = ess.getUser(event.getPlayer());
|
||||
|
||||
if (prot.getSettingBool(ProtectConfig.disable_build) && !user.canBuild())
|
||||
{
|
||||
@@ -228,7 +228,7 @@ public class EssentialsProtectBlockListener extends BlockListener
|
||||
{
|
||||
return;
|
||||
}
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
final IUser user = ess.getUser(event.getPlayer());
|
||||
|
||||
if (prot.getSettingBool(ProtectConfig.disable_build) && !user.canBuild())
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.protect;
|
||||
|
||||
import com.earth2me.essentials.IEssentials;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.api.IEssentials;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.craftbukkit.FakeExplosion;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.Material;
|
||||
@@ -39,7 +39,7 @@ public class EssentialsProtectEntityListener extends EntityListener
|
||||
return;
|
||||
}
|
||||
|
||||
final User user = ess.getUser(target);
|
||||
final IUser user = target instanceof Player ? ess.getUser((Player)target) : null;
|
||||
if (event instanceof EntityDamageByBlockEvent)
|
||||
{
|
||||
final DamageCause cause = event.getCause();
|
||||
@@ -77,7 +77,7 @@ public class EssentialsProtectEntityListener extends EntityListener
|
||||
{
|
||||
final EntityDamageByEntityEvent edEvent = (EntityDamageByEntityEvent)event;
|
||||
final Entity eAttack = edEvent.getDamager();
|
||||
final User attacker = ess.getUser(eAttack);
|
||||
final IUser attacker = eAttack instanceof Player ? ess.getUser((Player)eAttack) : null;
|
||||
|
||||
// PVP Settings
|
||||
if (target instanceof Player && eAttack instanceof Player
|
||||
@@ -134,7 +134,7 @@ public class EssentialsProtectEntityListener extends EntityListener
|
||||
|| (((Projectile)edEvent.getDamager()).getShooter() instanceof Player
|
||||
&& prot.getSettingBool(ProtectConfig.disable_pvp)
|
||||
&& (!user.isAuthorized("essentials.protect.pvp")
|
||||
|| !ess.getUser(((Projectile)edEvent.getDamager()).getShooter()).isAuthorized("essentials.protect.pvp")))))
|
||||
|| !ess.getUser((Player)((Projectile)edEvent.getDamager()).getShooter()).isAuthorized("essentials.protect.pvp")))))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@@ -299,7 +299,7 @@ public class EssentialsProtectEntityListener extends EntityListener
|
||||
{
|
||||
return;
|
||||
}
|
||||
final User user = ess.getUser(event.getTarget());
|
||||
final IUser user = ess.getUser((Player)event.getTarget());
|
||||
if ((event.getReason() == TargetReason.CLOSEST_PLAYER
|
||||
|| event.getReason() == TargetReason.TARGET_ATTACKED_ENTITY
|
||||
|| event.getReason() == TargetReason.PIG_ZOMBIE_TARGET
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package com.earth2me.essentials.protect;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.IEssentials;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.api.IEssentials;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.block.Action;
|
||||
@@ -26,7 +26,7 @@ public class EssentialsProtectPlayerListener extends PlayerListener
|
||||
public void onPlayerInteract(final PlayerInteractEvent event)
|
||||
{
|
||||
// Do not return if cancelled, because the interact event has 2 cancelled states.
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
final IUser user = ess.getUser(event.getPlayer());
|
||||
|
||||
if (event.hasItem()
|
||||
&& (event.getItem().getType() == Material.WATER_BUCKET
|
||||
|
Reference in New Issue
Block a user