Missed some parts for the last commits

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1555 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
snowleo 2011-06-01 11:26:12 +00:00
parent 86e40db6b9
commit 8e151357ce
6 changed files with 33 additions and 26 deletions

View file

@ -3,6 +3,7 @@ package com.earth2me.essentials.geoip;
import com.earth2me.essentials.Essentials; import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.EssentialsConf; import com.earth2me.essentials.EssentialsConf;
import com.earth2me.essentials.IConf; import com.earth2me.essentials.IConf;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.Util; import com.earth2me.essentials.Util;
import com.maxmind.geoip.Location; import com.maxmind.geoip.Location;
@ -44,7 +45,7 @@ public class EssentialsGeoIPPlayerListener extends PlayerListener implements ICo
@Override @Override
public void onPlayerJoin(PlayerJoinEvent event) public void onPlayerJoin(PlayerJoinEvent event)
{ {
Essentials ess = Essentials.getStatic(); IEssentials ess = Essentials.getStatic();
User u = ess.getUser(event.getPlayer()); User u = ess.getUser(event.getPlayer());
if (u.isAuthorized("essentials.geoip.hide")) if (u.isAuthorized("essentials.geoip.hide"))
{ {

View file

@ -4,8 +4,8 @@ import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.IConf; import com.earth2me.essentials.IConf;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.Util; import com.earth2me.essentials.Util;
import java.util.ArrayList; import java.util.List;
import java.util.HashMap; import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.bukkit.Location; import org.bukkit.Location;
@ -25,16 +25,16 @@ public class EssentialsProtect extends JavaPlugin implements IConf
private EssentialsProtectServerListener serverListener = null; private EssentialsProtectServerListener serverListener = null;
public static final String AUTHORS = Essentials.AUTHORS; public static final String AUTHORS = Essentials.AUTHORS;
private static final Logger logger = Logger.getLogger("Minecraft"); private static final Logger logger = Logger.getLogger("Minecraft");
public static HashMap<String, Boolean> genSettings = null; public static Map<String, Boolean> genSettings = null;
public static HashMap<String, String> dataSettings = null; public static Map<String, String> dataSettings = null;
public static HashMap<String, Boolean> guardSettings = null; public static Map<String, Boolean> guardSettings = null;
public static HashMap<String, Boolean> playerSettings = null; public static Map<String, Boolean> playerSettings = null;
public static ArrayList<Integer> usageList = null; public static List<Integer> usageList = null;
public static ArrayList<Integer> blackListPlace = null; public static List<Integer> blackListPlace = null;
public static ArrayList<Integer> breakBlackList = null; public static List<Integer> breakBlackList = null;
public static ArrayList<Integer> onPlaceAlert = null; public static List<Integer> onPlaceAlert = null;
public static ArrayList<Integer> onUseAlert = null; public static List<Integer> onUseAlert = null;
public static ArrayList<Integer> onBreakAlert = null; public static List<Integer> onBreakAlert = null;
public EssentialsProtect() public EssentialsProtect()
{ {
@ -81,7 +81,7 @@ public class EssentialsProtect extends JavaPlugin implements IConf
logger.info(Util.format("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), Essentials.AUTHORS)); logger.info(Util.format("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), Essentials.AUTHORS));
} }
public static boolean checkProtectionItems(ArrayList<Integer> itemList, int id) public static boolean checkProtectionItems(List<Integer> itemList, int id)
{ {
return !itemList.isEmpty() && itemList.contains(id); return !itemList.isEmpty() && itemList.contains(id);
} }

View file

@ -3,7 +3,6 @@ package com.earth2me.essentials.protect;
import com.earth2me.essentials.Essentials; import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.Util; import com.earth2me.essentials.Util;
import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;

View file

@ -2,6 +2,7 @@ package com.earth2me.essentials.spawn;
import org.bukkit.Server; import org.bukkit.Server;
import com.earth2me.essentials.Essentials; import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.Util; import com.earth2me.essentials.Util;
import com.earth2me.essentials.commands.EssentialsCommand; import com.earth2me.essentials.commands.EssentialsCommand;
@ -17,9 +18,10 @@ public class Commandsetspawn extends EssentialsCommand
@Override @Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{ {
final IEssentials ess = Essentials.getStatic();
charge(user); charge(user);
String group = args.length > 0 ? getFinalArg(args, 0) : "default"; final String group = args.length > 0 ? getFinalArg(args, 0) : "default";
Essentials.getSpawn().setSpawn(user.getLocation(), group); ess.getSpawn().setSpawn(user.getLocation(), group);
user.sendMessage(Util.format("spawnSet", group)); user.sendMessage(Util.format("spawnSet", group));
} }
} }

View file

@ -3,6 +3,7 @@ package com.earth2me.essentials.spawn;
import com.earth2me.essentials.Charge; import com.earth2me.essentials.Charge;
import org.bukkit.Server; import org.bukkit.Server;
import com.earth2me.essentials.Essentials; import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.commands.EssentialsCommand; import com.earth2me.essentials.commands.EssentialsCommand;
@ -17,8 +18,9 @@ public class Commandspawn extends EssentialsCommand
@Override @Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{ {
Charge charge = new Charge(this); final IEssentials ess = Essentials.getStatic();
final Charge charge = new Charge(this.getName(), ess);
charge.isAffordableFor(user); charge.isAffordableFor(user);
user.getTeleport().respawn(Essentials.getSpawn(), charge); user.getTeleport().respawn(ess.getSpawn(), charge);
} }
} }

View file

@ -1,6 +1,7 @@
package com.earth2me.essentials.spawn; package com.earth2me.essentials.spawn;
import com.earth2me.essentials.Essentials; import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.Util; import com.earth2me.essentials.Util;
import java.util.logging.Level; import java.util.logging.Level;
@ -16,11 +17,12 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
@Override @Override
public void onPlayerRespawn(PlayerRespawnEvent event) public void onPlayerRespawn(PlayerRespawnEvent event)
{ {
User user = Essentials.getStatic().getUser(event.getPlayer()); final IEssentials ess = Essentials.getStatic();
final User user = ess.getUser(event.getPlayer());
try try
{ {
if (Essentials.getStatic().getSettings().getRespawnAtHome()) if (ess.getSettings().getRespawnAtHome())
{ {
Location home = user.getHome(user.getLocation()); Location home = user.getHome(user.getLocation());
if (home == null) { if (home == null) {
@ -33,7 +35,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
catch (Throwable ex) catch (Throwable ex)
{ {
} }
Location spawn = Essentials.getSpawn().getSpawn(user.getGroup()); Location spawn = ess.getSpawn().getSpawn(user.getGroup());
if (spawn == null) { if (spawn == null) {
return; return;
} }
@ -43,7 +45,8 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
@Override @Override
public void onPlayerJoin(PlayerJoinEvent event) public void onPlayerJoin(PlayerJoinEvent event)
{ {
User user = Essentials.getStatic().getUser(event.getPlayer()); final IEssentials ess = Essentials.getStatic();
final User user = ess.getUser(event.getPlayer());
if (!user.isNew()) if (!user.isNew())
{ {
@ -51,14 +54,14 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
} }
user.setNew(false); user.setNew(false);
try { try {
user.getTeleport().now(Essentials.getSpawn().getSpawn(Essentials.getStatic().getSettings().getNewbieSpawn())); user.getTeleport().now(ess.getSpawn().getSpawn(ess.getSettings().getNewbieSpawn()));
} catch (Exception ex) { } catch (Exception ex) {
Logger.getLogger("Minecraft").log(Level.WARNING, Util.i18n("teleportNewPlayerError"), ex); Logger.getLogger("Minecraft").log(Level.WARNING, Util.i18n("teleportNewPlayerError"), ex);
} }
if (Essentials.getStatic().getSettings().getAnnounceNewPlayers()) if (ess.getSettings().getAnnounceNewPlayers())
{ {
Essentials.getStatic().broadcastMessage(user.getName(), Essentials.getStatic().getSettings().getAnnounceNewPlayerFormat(user)); ess.broadcastMessage(user.getName(), ess.getSettings().getAnnounceNewPlayerFormat(user));
} }
} }
} }