3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 20:40:08 +01:00

Deprecation cleanup.

Dieser Commit ist enthalten in:
Erik Broes 2012-01-30 21:51:53 +01:00 committet von EvilSeph
Ursprung 3b634b14f6
Commit 137880b727
15 geänderte Dateien mit 110 neuen und 114 gelöschten Zeilen

Datei anzeigen

@ -27,8 +27,8 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.LoggerOutputStream;
import org.bukkit.craftbukkit.scheduler.CraftScheduler;
import org.bukkit.craftbukkit.util.ServerShutdownThread;
import org.bukkit.event.Event;
import org.bukkit.event.server.ServerCommandEvent;
import org.bukkit.event.server.RemoteServerCommandEvent;
import org.bukkit.event.world.WorldInitEvent;
import org.bukkit.event.world.WorldLoadEvent;
import org.bukkit.event.world.WorldSaveEvent;
@ -565,7 +565,7 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
ServerCommand servercommand = (ServerCommand) this.y.remove(0);
// CraftBukkit start - ServerCommand for preprocessing
ServerCommandEvent event = new ServerCommandEvent(Event.Type.SERVER_COMMAND, this.console, servercommand.command);
ServerCommandEvent event = new ServerCommandEvent(this.console, servercommand.command);
this.server.getPluginManager().callEvent(event);
servercommand = new ServerCommand(event.getCommand(), servercommand.source);
// CraftBukkit end
@ -711,7 +711,7 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
public String d(String s) {
RemoteControlCommandListener.instance.a();
// CraftBukkit start
ServerCommandEvent event = new ServerCommandEvent(Event.Type.REMOTE_COMMAND, this.remoteConsole, s);
RemoteServerCommandEvent event = new RemoteServerCommandEvent(this.remoteConsole, s);
this.server.getPluginManager().callEvent(event);
ServerCommand servercommand = new ServerCommand(event.getCommand(), RemoteControlCommandListener.instance);
// this.consoleCommandHandler.handle(new ServerCommand(s, RemoteControlCommandListener.instance)); // CraftBukkit - removed

Datei anzeigen

@ -1,27 +1,8 @@
package org.bukkit.craftbukkit;
import java.io.FileNotFoundException;
import org.bukkit.generator.ChunkGenerator;
import com.avaje.ebean.config.DataSourceConfig;
import com.avaje.ebean.config.ServerConfig;
import com.avaje.ebean.config.dbplatform.SQLitePlatform;
import com.avaje.ebeaninternal.server.lib.sql.TransactionIsolation;
import com.google.common.collect.MapMaker;
import net.minecraft.server.IWorldAccess;
import org.bukkit.World.Environment;
import org.bukkit.command.*;
import org.bukkit.entity.Player;
import org.bukkit.event.world.WorldLoadEvent;
import org.bukkit.event.world.WorldSaveEvent;
import org.bukkit.event.world.WorldUnloadEvent;
import org.bukkit.inventory.FurnaceRecipe;
import org.bukkit.inventory.Recipe;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.inventory.ShapelessRecipe;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
@ -29,11 +10,11 @@ import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.Set;
import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
import jline.ConsoleReader;
import net.minecraft.server.ChunkCoordinates;
import net.minecraft.server.ConvertProgressUpdater;
import net.minecraft.server.Convertable;
@ -41,64 +22,96 @@ import net.minecraft.server.Enchantment;
import net.minecraft.server.EntityPlayer;
import net.minecraft.server.EntityTracker;
import net.minecraft.server.IProgressUpdate;
import net.minecraft.server.IWorldAccess;
import net.minecraft.server.Item;
import net.minecraft.server.ItemStack;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.MobEffectList;
import net.minecraft.server.PropertyManager;
import net.minecraft.server.ServerCommand;
import net.minecraft.server.ServerConfigurationManager;
import net.minecraft.server.ServerNBTManager;
import net.minecraft.server.WorldLoaderServer;
import net.minecraft.server.WorldManager;
import net.minecraft.server.WorldServer;
import net.minecraft.server.ServerCommand;
import net.minecraft.server.Item;
import net.minecraft.server.ItemStack;
import net.minecraft.server.WorldMap;
import net.minecraft.server.WorldMapCollection;
import net.minecraft.server.WorldNBTStorage;
import net.minecraft.server.WorldServer;
import net.minecraft.server.WorldSettings;
import net.minecraft.server.WorldType;
import org.bukkit.*;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.OfflinePlayer;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.WorldCreator;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.command.PluginCommand;
import org.bukkit.command.SimpleCommandMap;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.configuration.serialization.ConfigurationSerialization;
import org.bukkit.permissions.Permissible;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.ServicesManager;
import org.bukkit.plugin.SimplePluginManager;
import org.bukkit.plugin.SimpleServicesManager;
import org.bukkit.plugin.java.JavaPluginLoader;
import org.bukkit.plugin.messaging.Messenger;
import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.craftbukkit.inventory.CraftFurnaceRecipe;
import org.bukkit.craftbukkit.inventory.CraftRecipe;
import org.bukkit.craftbukkit.inventory.CraftShapedRecipe;
import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe;
import org.bukkit.craftbukkit.map.CraftMapView;
import org.bukkit.craftbukkit.potion.CraftPotionBrewer;
import org.bukkit.scheduler.BukkitWorker;
import org.bukkit.craftbukkit.scheduler.CraftScheduler;
import org.bukkit.craftbukkit.updater.AutoUpdater;
import org.bukkit.craftbukkit.updater.BukkitDLUpdaterService;
import org.bukkit.craftbukkit.util.DatFileFilter;
import org.bukkit.craftbukkit.util.Versioning;
import org.bukkit.util.permissions.DefaultPermissions;
import org.bukkit.entity.Player;
import org.bukkit.event.world.WorldInitEvent;
import org.bukkit.event.world.WorldLoadEvent;
import org.bukkit.event.world.WorldSaveEvent;
import org.bukkit.event.world.WorldUnloadEvent;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.inventory.FurnaceRecipe;
import org.bukkit.inventory.Recipe;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.inventory.ShapelessRecipe;
import org.bukkit.permissions.Permissible;
import org.bukkit.permissions.Permission;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginLoadOrder;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.ServicesManager;
import org.bukkit.plugin.SimplePluginManager;
import org.bukkit.plugin.SimpleServicesManager;
import org.bukkit.plugin.java.JavaPluginLoader;
import org.bukkit.plugin.messaging.Messenger;
import org.bukkit.potion.Potion;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.plugin.messaging.StandardMessenger;
import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.scheduler.BukkitWorker;
import org.bukkit.util.permissions.DefaultPermissions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.SafeConstructor;
import org.yaml.snakeyaml.error.MarkedYAMLException;
import com.avaje.ebean.config.DataSourceConfig;
import com.avaje.ebean.config.ServerConfig;
import com.avaje.ebean.config.dbplatform.SQLitePlatform;
import com.avaje.ebeaninternal.server.lib.sql.TransactionIsolation;
import com.google.common.collect.MapMaker;
import jline.ConsoleReader;
public final class CraftServer implements Server {
private final String serverName = "CraftBukkit";
private final String serverVersion;
private final String bukkitVersion = Versioning.getBukkitVersion();
private final ServicesManager servicesManager = new SimpleServicesManager();
private final BukkitScheduler scheduler = new CraftScheduler(this);
private final BukkitScheduler scheduler = new CraftScheduler();
private final SimpleCommandMap commandMap = new SimpleCommandMap(this);
private final StandardMessenger messenger = new StandardMessenger();
private final PluginManager pluginManager = new SimplePluginManager(this, commandMap);
@ -480,6 +493,7 @@ public final class CraftServer implements Server {
enablePlugins(PluginLoadOrder.POSTWORLD);
}
@SuppressWarnings({ "unchecked", "finally" })
private void loadCustomPermissions() {
File file = new File(configuration.getString("settings.permissions-file"));
FileInputStream stream;
@ -894,8 +908,9 @@ public final class CraftServer implements Server {
return result;
}
@SuppressWarnings("unchecked")
public Set<String> getIPBans() {
return new HashSet(server.banByIP);
return new HashSet<String>(server.banByIP);
}
public void banIP(String address) {

Datei anzeigen

@ -5,21 +5,21 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
import org.bukkit.block.PistonMoveReaction;
import net.minecraft.server.BiomeBase;
import net.minecraft.server.BlockRedstoneWire;
import net.minecraft.server.EnumSkyBlock;
import net.minecraft.server.MinecraftServer;
import org.bukkit.*;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.PistonMoveReaction;
import org.bukkit.craftbukkit.CraftChunk;
import org.bukkit.inventory.ItemStack;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.util.BlockVector;
public class CraftBlock implements Block {

Datei anzeigen

@ -1,14 +1,11 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityArrow;
import net.minecraft.server.EntityLiving;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity;
import javax.swing.text.html.parser.Entity;
public class CraftArrow extends AbstractProjectile implements Arrow {
public CraftArrow(CraftServer server, EntityArrow entity) {

Datei anzeigen

@ -1,7 +1,7 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityBlaze;
import net.minecraft.server.EntityMonster;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Blaze;

Datei anzeigen

@ -1,22 +1,27 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.Entity;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import net.minecraft.server.DamageSource;
import net.minecraft.server.EntityArrow;
import net.minecraft.server.EntityEgg;
import net.minecraft.server.EntityLiving;
import net.minecraft.server.EntitySnowball;
import net.minecraft.server.EntityPlayer;
import net.minecraft.server.MobEffect;
import net.minecraft.server.MobEffectList;
import net.minecraft.server.EntitySnowball;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.potion.CraftPotionEffectType;
import org.bukkit.block.Block;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Egg;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Snowball;
@ -26,12 +31,6 @@ import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.BlockIterator;
import java.util.Collection;
import java.util.List;
import java.util.HashSet;
import java.util.ArrayList;
import java.util.Iterator;
import net.minecraft.server.DamageSource;
import org.bukkit.entity.HumanEntity;
public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public CraftLivingEntity(final CraftServer server, final EntityLiving entity) {

Datei anzeigen

@ -2,8 +2,6 @@ package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityPainting;
import net.minecraft.server.EnumArt;
import net.minecraft.server.Packet25EntityPainting;
import net.minecraft.server.Packet29DestroyEntity;
import net.minecraft.server.WorldServer;
import org.bukkit.Art;

Datei anzeigen

@ -59,7 +59,6 @@ import org.bukkit.entity.CreatureType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.event.Event.Type;
import org.bukkit.event.block.*;
import org.bukkit.event.entity.*;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
@ -115,14 +114,14 @@ public class CraftEventFactory {
* Bucket methods
*/
public static PlayerBucketEmptyEvent callPlayerBucketEmptyEvent(EntityHuman who, int clickedX, int clickedY, int clickedZ, int clickedFace, ItemStack itemInHand) {
return (PlayerBucketEmptyEvent) getPlayerBucketEvent(Type.PLAYER_BUCKET_EMPTY, who, clickedX, clickedY, clickedZ, clickedFace, itemInHand, Item.BUCKET);
return (PlayerBucketEmptyEvent) getPlayerBucketEvent(false, who, clickedX, clickedY, clickedZ, clickedFace, itemInHand, Item.BUCKET);
}
public static PlayerBucketFillEvent callPlayerBucketFillEvent(EntityHuman who, int clickedX, int clickedY, int clickedZ, int clickedFace, ItemStack itemInHand, net.minecraft.server.Item bucket) {
return (PlayerBucketFillEvent) getPlayerBucketEvent(Type.PLAYER_BUCKET_FILL, who, clickedX, clickedY, clickedZ, clickedFace, itemInHand, bucket);
return (PlayerBucketFillEvent) getPlayerBucketEvent(true, who, clickedX, clickedY, clickedZ, clickedFace, itemInHand, bucket);
}
private static PlayerEvent getPlayerBucketEvent(Type type, EntityHuman who, int clickedX, int clickedY, int clickedZ, int clickedFace, ItemStack itemstack, net.minecraft.server.Item item) {
private static PlayerEvent getPlayerBucketEvent(boolean isFilling, EntityHuman who, int clickedX, int clickedY, int clickedZ, int clickedFace, ItemStack itemstack, net.minecraft.server.Item item) {
Player player = (who == null) ? null : (Player) who.getBukkitEntity();
CraftItemStack itemInHand = new CraftItemStack(new ItemStack(item));
Material bucket = Material.getMaterial(itemstack.id);
@ -134,12 +133,12 @@ public class CraftEventFactory {
BlockFace blockFace = CraftBlock.notchToBlockFace(clickedFace);
PlayerEvent event = null;
if (type == Type.PLAYER_BUCKET_EMPTY) {
event = new PlayerBucketEmptyEvent(player, blockClicked, blockFace, bucket, itemInHand);
((PlayerBucketEmptyEvent) event).setCancelled(!canBuild(craftWorld, player, clickedX, clickedZ));
} else if (type == Type.PLAYER_BUCKET_FILL) {
if (isFilling) {
event = new PlayerBucketFillEvent(player, blockClicked, blockFace, bucket, itemInHand);
((PlayerBucketFillEvent) event).setCancelled(!canBuild(craftWorld, player, clickedX, clickedZ));
} else {
event = new PlayerBucketEmptyEvent(player, blockClicked, blockFace, bucket, itemInHand);
((PlayerBucketEmptyEvent) event).setCancelled(!canBuild(craftWorld, player, clickedX, clickedZ));
}
craftServer.getPluginManager().callEvent(event);

Datei anzeigen

@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.generator;
import java.util.List;
import java.util.Random;
import net.minecraft.server.BiomeBase;
import net.minecraft.server.Chunk;
import net.minecraft.server.ChunkCoordIntPair;
@ -13,6 +14,7 @@ import net.minecraft.server.World;
import net.minecraft.server.WorldChunkManager;
import net.minecraft.server.WorldGenStronghold;
import net.minecraft.server.WorldServer;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator;
@ -78,7 +80,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
return generator.getDefaultPopulators(world);
}
public List getMobsFor(EnumCreatureType type, int x, int y, int z) {
public List<?> getMobsFor(EnumCreatureType type, int x, int y, int z) {
WorldChunkManager worldchunkmanager = world.getWorldChunkManager();
if (worldchunkmanager == null) {

Datei anzeigen

@ -3,12 +3,14 @@ package org.bukkit.craftbukkit.generator;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.minecraft.server.Chunk;
import net.minecraft.server.ChunkPosition;
import net.minecraft.server.EnumCreatureType;
import net.minecraft.server.IChunkProvider;
import net.minecraft.server.IProgressUpdate;
import net.minecraft.server.World;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.generator.BlockPopulator;
@ -59,7 +61,7 @@ public class NormalChunkGenerator extends InternalChunkGenerator {
return provider.canSave();
}
public List getMobsFor(EnumCreatureType ect, int i, int i1, int i2) {
public List<?> getMobsFor(EnumCreatureType ect, int i, int i1, int i2) {
return provider.getMobsFor(ect, i, i1, i2);
}

Datei anzeigen

@ -5,18 +5,16 @@ import net.minecraft.server.WorldMapDecoration;
import org.bukkit.entity.Player;
import org.bukkit.map.MapCanvas;
import org.bukkit.map.MapCursorCollection;
import org.bukkit.map.MapRenderer;
import org.bukkit.map.MapView;
import org.bukkit.map.MapCursorCollection;
public class CraftMapRenderer extends MapRenderer {
private final CraftMapView mapView;
private final WorldMap worldMap;
public CraftMapRenderer(CraftMapView mapView, WorldMap worldMap) {
super(false);
this.mapView = mapView;
this.worldMap = worldMap;
}

Datei anzeigen

@ -1,11 +1,11 @@
package org.bukkit.craftbukkit.scheduler;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.CancellationException;
public class CraftFuture<T> implements Runnable, Future<T> {
@ -18,7 +18,7 @@ public class CraftFuture<T> implements Runnable, Future<T> {
private Exception e = null;
private int taskId = -1;
CraftFuture(CraftScheduler craftScheduler, Callable callable) {
CraftFuture(CraftScheduler craftScheduler, Callable<T> callable) {
this.callable = callable;
this.craftScheduler = craftScheduler;
}

Datei anzeigen

@ -1,33 +1,26 @@
package org.bukkit.craftbukkit.scheduler;
import java.util.LinkedList;
import java.util.TreeMap;
import java.util.Iterator;
import java.util.List;
import java.util.ArrayList;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.TreeMap;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.scheduler.BukkitWorker;
import org.bukkit.scheduler.BukkitTask;
import org.bukkit.plugin.Plugin;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.scheduler.CraftTask;
import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.scheduler.BukkitTask;
import org.bukkit.scheduler.BukkitWorker;
public class CraftScheduler implements BukkitScheduler, Runnable {
private static final Logger logger = Logger.getLogger("Minecraft");
private final CraftServer server;
private final CraftThreadManager craftThreadManager = new CraftThreadManager();
private final LinkedList<CraftTask> mainThreadQueue = new LinkedList<CraftTask>();
@ -35,13 +28,17 @@ public class CraftScheduler implements BukkitScheduler, Runnable {
private final TreeMap<CraftTask, Boolean> schedulerQueue = new TreeMap<CraftTask, Boolean>();
private final Object currentTickSync = new Object();
private Long currentTick = 0L;
// This lock locks the mainThreadQueue and the currentTick value
private final Lock mainThreadLock = new ReentrantLock();
private final Lock syncedTasksLock = new ReentrantLock();
public CraftScheduler() {
Thread t = new Thread(this);
t.start();
}
public void run() {
while (true) {
@ -108,14 +105,6 @@ public class CraftScheduler implements BukkitScheduler, Runnable {
}
}
public CraftScheduler(CraftServer server) {
this.server = server;
Thread t = new Thread(this);
t.start();
}
// If the main thread cannot obtain the lock, it doesn't wait
public void mainThreadHeartbeat(long currentTick) {
if (syncedTasksLock.tryLock()) {

Datei anzeigen

@ -1,12 +1,9 @@
package org.bukkit.craftbukkit.util;
import net.minecraft.server.Chunk;
import net.minecraft.server.MinecraftServer;
import static org.bukkit.craftbukkit.util.Java15Compat.Arrays_copyOf;
import java.util.ArrayList;
import static org.bukkit.craftbukkit.util.Java15Compat.Arrays_copyOf;
public class LongBaseHashtable extends LongHash {
EntryBase[][][] values = new EntryBase[256][][];

Datei anzeigen

@ -2,8 +2,6 @@ package org.bukkit.craftbukkit.util;
import java.util.ArrayList;
import static org.bukkit.craftbukkit.util.Java15Compat.Arrays_copyOf;
public class LongHashtable<V> extends LongBaseHashtable {
public void put(int msw, int lsw, V value) {
@ -18,11 +16,13 @@ public class LongHashtable<V> extends LongBaseHashtable {
put(new Entry(key, value));
}
@SuppressWarnings("unchecked")
public synchronized V get(long key) {
Entry entry = ((Entry) getEntry(key));
return entry != null ? entry.value : null;
}
@SuppressWarnings("unchecked")
public synchronized ArrayList<V> values() {
ArrayList<V> ret = new ArrayList<V>();