Importing Bukkit is usually bad.

This commit is contained in:
GJ 2013-03-10 15:07:07 -04:00
parent 2cef6700c7
commit c0b4a33346
8 changed files with 14 additions and 19 deletions

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.commands.player;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@ -119,6 +118,6 @@ public class McrankCommand implements CommandExecutor {
}
private void sqlDisplay(CommandSender sender, String playerName) {
Bukkit.getScheduler().runTaskAsynchronously(mcMMO.p, new McrankCommandAsyncTask(playerName, sender));
mcMMO.p.getServer().getScheduler().runTaskAsynchronously(mcMMO.p, new McrankCommandAsyncTask(playerName, sender));
}
}

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.commands.player;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@ -124,6 +123,6 @@ public class MctopCommand implements CommandExecutor {
}
private void sqlDisplay(int page, String query, CommandSender sender, Command command) {
Bukkit.getScheduler().runTaskAsynchronously(mcMMO.p, new MctopCommandAsyncTask(page, query, sender, command));
mcMMO.p.getServer().getScheduler().runTaskAsynchronously(mcMMO.p, new MctopCommandAsyncTask(page, query, sender, command));
}
}

View File

@ -8,7 +8,6 @@ import java.util.List;
import net.shatteredlands.shatt.backup.ZipLibrary;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
@ -156,7 +155,7 @@ public class mcMMO extends JavaPlugin {
getLogger().info("Please do not replace the mcMMO jar while the server is running.");
}
Bukkit.getPluginManager().disablePlugin(this);
getServer().getPluginManager().disablePlugin(this);
}
}

View File

@ -2,7 +2,6 @@ package com.gmail.nossr50.runnables.commands;
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import com.gmail.nossr50.mcMMO;
@ -24,7 +23,7 @@ public class McrankCommandAsyncTask implements Runnable {
public void run() {
final Map<String, Integer> skills = DatabaseManager.readSQLRank(playerName);
Bukkit.getScheduler().scheduleSyncDelayedTask(mcMMO.p, new Runnable() {
mcMMO.p.getServer().getScheduler().scheduleSyncDelayedTask(mcMMO.p, new Runnable() {
@Override
public void run() {
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Heading"));

View File

@ -3,7 +3,6 @@ package com.gmail.nossr50.runnables.commands;
import java.util.ArrayList;
import java.util.HashMap;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -40,7 +39,7 @@ public class MctopCommandAsyncTask implements Runnable {
}
String tablePrefix = Config.getInstance().getMySQLTablePrefix();
final HashMap<Integer, ArrayList<String>> userslist = DatabaseManager.read("SELECT " + query + ", user, NOW() FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON (user_id = id) WHERE " + query + " > 0 ORDER BY " + query + " DESC, user LIMIT " + ((page * 10) - 10) + ",10");
Bukkit.getScheduler().scheduleSyncDelayedTask(mcMMO.p, new Runnable() {
mcMMO.p.getServer().getScheduler().scheduleSyncDelayedTask(mcMMO.p, new Runnable() {
@Override
public void run() {
if (query.equals("taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing")) {

View File

@ -12,7 +12,6 @@ import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
@ -98,7 +97,7 @@ public final class HolidayManager {
final int firework_amount = 10;
for (int i = 0; i < firework_amount; i++) {
int delay = (int) (Math.random() * 3) + 4;
Bukkit.getScheduler().scheduleSyncDelayedTask(mcMMO.p, new Runnable() {
mcMMO.p.getServer().getScheduler().scheduleSyncDelayedTask(mcMMO.p, new Runnable() {
@Override
public void run() {
spawnFireworks((Player) sender);

View File

@ -11,10 +11,11 @@ import java.io.StreamCorruptedException;
import java.io.UTFDataFormatException;
import java.util.HashMap;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.block.Block;
import com.gmail.nossr50.mcMMO;
public class HashChunkletManager implements ChunkletManager {
public HashMap<String, ChunkletStore> store = new HashMap<String, ChunkletStore>();
@ -168,7 +169,7 @@ public class HashChunkletManager implements ChunkletManager {
@Override
public void saveAll() {
for (World world : Bukkit.getWorlds()) {
for (World world : mcMMO.p.getServer().getWorlds()) {
saveWorld(world);
}
}
@ -176,7 +177,7 @@ public class HashChunkletManager implements ChunkletManager {
@Override
public void unloadAll() {
saveAll();
for (World world : Bukkit.getWorlds()) {
for (World world : mcMMO.p.getServer().getWorlds()) {
unloadWorld(world);
}
}
@ -276,7 +277,7 @@ public class HashChunkletManager implements ChunkletManager {
for (String key : store.keySet()) {
if (store.get(key).isEmpty()) {
String[] info = key.split(",");
File dataDir = new File(Bukkit.getWorld(info[0]).getWorldFolder(), "mcmmo_data");
File dataDir = new File(mcMMO.p.getServer().getWorld(info[0]).getWorldFolder(), "mcmmo_data");
File cxDir = new File(dataDir, "" + info[1]);
if (!cxDir.exists()) {

View File

@ -11,12 +11,12 @@ import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.entity.Entity;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.blockmeta.conversion.BlockStoreConversionZDirectory;
public class HashChunkManager implements ChunkManager {
@ -283,7 +283,7 @@ public class HashChunkManager implements ChunkManager {
public synchronized void saveAll() {
closeAll();
for (World world : Bukkit.getWorlds()) {
for (World world : mcMMO.p.getServer().getWorlds()) {
saveWorld(world);
}
}
@ -292,7 +292,7 @@ public class HashChunkManager implements ChunkManager {
public synchronized void unloadAll() {
closeAll();
for (World world : Bukkit.getWorlds()) {
for (World world : mcMMO.p.getServer().getWorlds()) {
unloadWorld(world);
}
}