Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove methods deprecated during the 0.99.*.* release cycle, in time for the beginning of the 0.101.*.* release cycle. #7656

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,10 @@ public static boolean hasAccount(String accountName) {
return account != null && hasAccount(account);
}

/**
* @deprecated since 0.100.4.6, with no replacement.
* @return true if the Server economy is Essentials Economy.
*/
@Deprecated
public static boolean isEssentials() {
return getVersion().startsWith("EssentialsX Economy") || getVersion().startsWith("Essentials Economy");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,19 +323,6 @@ public static TownLevel getTownLevel(Town town) {
return getTownLevel(town.getLevelNumber());
}

/**
* @deprecated since 0.99.6.3 use {@link #getTownLevelWithModifier(int, Town)}
* instead.
* @param town Town to test with.
* @param residents an int representing what modifies a townlevel, typically the
* number of residents in the town.
* @return the TownLevel given the number of residents.
*/
@Deprecated
public static TownLevel getTownLevel(Town town, int residents) {
return getTownLevelWithModifier(residents, town);
}

public static TownLevel getTownLevelWithModifier(int modifier, Town town) {
return getTownLevel(getTownLevelFromGivenInt(modifier, town));
}
Expand Down Expand Up @@ -392,19 +379,6 @@ public static NationLevel getNationLevel(Nation nation) {
return getNationLevel(nation.getLevelNumber());
}

/**
* @deprecated since 0.99.6.2 use {@link #getNationLevelWithModifier(int)} instead.
* @param nation Nation to test with, unused.
* @param residents an int representing what modifies a nationlevel.
* {@link #isNationLevelDeterminedByTownCount()} decides
* whether it is residents or towns.
* @return the NationLevel given the number of residents/towns.
*/
@Deprecated
public static NationLevel getNationLevel(Nation nation, int residents) {
return getNationLevelWithModifier(residents);
}

public static NationLevel getNationLevelWithModifier(int modifier) {
return getNationLevel(getNationLevelFromGivenInt(modifier));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,6 @@ public void finishTasks() {
hikariDataSource.close();
}

/**
* open a connection to the SQL server.
*
* @return true if we successfully connected to the db.
* @deprecated as of 0.99.1.2, use {@link #getConnection()} to obtain a connection instead.
*/
@Deprecated(forRemoval = true)
public boolean getContext() {
return isReady();
}

/**
* @return Whether the datasource is initialized and running.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -674,45 +674,6 @@ public boolean exists() {
return TownyUniverse.getInstance().hasNation(getName());
}

/**
* @deprecated since 0.99.6.2, use {@link #getLevelNumber()} instead.
* Get the Nation's current Nation Level.
* <p>
* Note that Nation Levels are not hard-coded. They can be defined by the server administrator,
* and may be different from the default configuration.
* </p>
* @return Nation Level (int) for current population or amount of towns.
*/
@Deprecated
public int getLevel() {
return getLevelNumber();
}

/**
* @deprecated since 0.99.6.2 use {@link TownySettings#getNationLevelMax()} instead.
* Get the maximum level a Nation may achieve.
* @return Size of TownySettings' configNationLevel SortedMap.
*/
@Deprecated
public int getMaxLevel() {
return TownySettings.getConfigNationLevel().size();
}

/**
* @deprecated since 0.99.6.2 use {@link TownySettings#getNationLevelFromGivenInt(int)} instead.
* Get the Nation's Level for a supposed population size.
* <p>
* Note that Nation Levels are not hard-coded. They can be defined by the server administrator,
* and may be different from the default configuration.
* </p>
* @param populationSize Number of residents in the Nation, theoretical or real.
* @return Nation Level (int) for the supplied populationSize.
*/
@Deprecated
public int getLevel(int populationSize) {
return TownySettings.getNationLevelFromGivenInt(populationSize);
}

public void playerBroadCastMessageToNation(Player player, String message) {
TownyMessaging.sendPrefixedNationMessage(this, Translatable.of("town_say_format", player.getName(), TownyComponents.stripClickTags(message)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@

import com.palmergames.bukkit.towny.object.TownyPermission.ActionType;

import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public class PlayerCache {

Expand All @@ -20,11 +17,8 @@ public class PlayerCache {

private WorldCoord lastWorldCoord;
private String blockErrMsg;
private final UUID playerUUID;

public PlayerCache(Player player) {
this.lastWorldCoord = WorldCoord.parseWorldCoord(player);
this.playerUUID = player.getUniqueId();
}

/**
Expand Down Expand Up @@ -197,24 +191,4 @@ public boolean hasBlockErrMsg() {

return blockErrMsg != null;
}

/**
* Deprecated as of 0.99.5.9, location caching is no longer used.
*/
@Deprecated
public void setLastLocation(Location lastLocation) {

}

/**
* @deprecated Deprecated as of 0.99.5.9, location caching is no longer used.
*/
@Deprecated
public Location getLastLocation() throws NullPointerException {
final Player player = Bukkit.getServer().getPlayer(this.playerUUID);
if (player == null)
throw new NullPointerException(); // adhere to the throws contract

return player.getLocation();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -427,53 +427,20 @@ public List<String> getTreeString(int depth) {
return out;
}

/**
* @deprecated Deprecated as of 0.99.0.10, clearing teleport requests is no longer needed.
* Use {@link com.palmergames.bukkit.towny.TownyAPI#abortTeleportRequest(Resident)} to abort an active teleport request.
*/
@Deprecated
public void clearTeleportRequest() {

}

/**
* @deprecated Deprecated as of 0.99.0.10, teleport request related values are no longer modifiable once the teleport has been requested.
*/
@Deprecated
public void setTeleportRequestTime() {

}

@ApiStatus.Obsolete
public long getTeleportRequestTime() {
TeleportRequest request = TeleportWarmupTimerTask.getTeleportRequest(this);

return request == null ? -1 : request.requestTime();
}

/**
* @deprecated Deprecated as of 0.99.0.10, teleport request related values are no longer modifiable once the teleport has been requested.
*/
@Deprecated
public void setTeleportDestination(Location spawnLoc) {

}

@ApiStatus.Obsolete
public Location getTeleportDestination() {
TeleportRequest request = TeleportWarmupTimerTask.getTeleportRequest(this);

return request == null ? null : request.destinationLocation();
}

/**
* @deprecated Deprecated as of 0.99.0.10, teleport request related values are no longer modifiable once the teleport has been requested.
*/
@Deprecated
public void setTeleportCooldown(int cooldown) {

}

@ApiStatus.Obsolete
public int getTeleportCooldown() {
TeleportRequest request = TeleportWarmupTimerTask.getTeleportRequest(this);
Expand All @@ -488,29 +455,13 @@ public boolean hasRequestedTeleport() {
return TeleportWarmupTimerTask.hasTeleportRequest(this);
}

/**
* @deprecated Deprecated as of 0.99.0.10, teleport request related values are no longer modifiable once the teleport has been requested.
*/
@Deprecated
public void setTeleportCost(double cost) {

}

@ApiStatus.Obsolete
public double getTeleportCost() {
TeleportRequest request = TeleportWarmupTimerTask.getTeleportRequest(this);

return request == null ? 0 : request.teleportCost();
}

/**
* @deprecated Deprecated as of 0.99.0.10, teleport request related values are no longer modifiable once the teleport has been requested.
*/
@Deprecated
public void setTeleportAccount(Account payee) {

}

@ApiStatus.Obsolete
public Account getTeleportAccount() {
TeleportRequest request = TeleportWarmupTimerTask.getTeleportRequest(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ private SpawnPointLocation(Position position) {
super(position.world(), position.blockX(), position.blockY(), position.blockZ(), 0F, 0F);
}

/**
* @deprecated Deprecated as of 0.99.5.9, please use {@link #world()} instead.
*/
@Deprecated
public String getWorld() {
return world().getName();
}

public int getX() {
return blockX();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ public class TeleportWarmupParticle {
public static final int RING_POINT_COUNT = 12;
public static final int RING_DELAY_TICKS = 2;

@Deprecated
public TeleportWarmupParticle(Location loc) {

}

public static void drawParticles(final Player player, final double yOffset) {
Particle spawnParticle = BukkitParticle.getSpawnPointParticle();
int i = 0;
Expand Down
52 changes: 0 additions & 52 deletions Towny/src/main/java/com/palmergames/bukkit/towny/object/Town.java
Original file line number Diff line number Diff line change
Expand Up @@ -1902,58 +1902,6 @@ public int getLevelNumber() {
BukkitTools.fireEvent(tctle);
return tctle.getTownLevelNumber();
}

/**
* @deprecated since 0.99.6.3 use {@link #getLevelNumber()} instead.
* Get the Town's current level, based on its population.
* <p>
* Note that Town Levels are not hard-coded. They can be defined by the server administrator,
* and may be different from the default configuration.
* </p>
* @return Current Town Level.
*/
@Deprecated
public int getLevel() {
return getLevelNumber();
}

/**
* @deprecated since 0.99.6.3 use {@link TownySettings#getTownLevelFromGivenInt(int, Town)} instead.
* Get the town level for a given population size.
* <p>
* Great for debugging, or just to see what the town level is for a given amount of residents.
* But for most cases you'll want to use {@link Town#getLevel()}, which uses the town's current population.
* <br />
* Note that Town Levels are not hard-coded. They can be defined by the server administrator,
* and may be different from the default configuration.
* </p>
* @param populationSize Number of residents used to calculate the level.
* @return The calculated Town Level. 0, if the town is ruined, or the method otherwise fails through.
*/
@Deprecated
public int getLevel(int populationSize) {
return TownySettings.getTownLevelFromGivenInt(populationSize, this);
}

/**
* @deprecated since 0.99.6.3 use {@link TownySettings#getTownLevelMax()} instead.
* Get the maximum level a Town may achieve.
* @return Size of TownySettings' configTownLevel SortedMap.
*/
@Deprecated
public int getMaxLevel() {
return TownySettings.getConfigTownLevel().size();
}

/**
* @deprecated since 0.99.6.3 use {@link #getLevelNumber()} instead.
* Returns the Town Level ID.
* @return id
*/
@Deprecated
public int getLevelID() {
return getLevelNumber();
}

/**
* @return the manualTownLevel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,27 +443,11 @@ public void setName(String newName) {
super.setName(newName.replace("_", " "));
}

/**
* @deprecated Deprecated as of 0.99.5.3, it is no longer possible to mutate the world/coordinates of a townblock.
*/
@Deprecated
public void setX(int x) {

}

public int getX() {

return this.worldCoord.getX();
}

/**
* @deprecated Deprecated as of 0.99.5.3, it is no longer possible to mutate the world/coordinates of a townblock.
*/
@Deprecated
public void setZ(int z) {

}

public int getZ() {

return this.worldCoord.getZ();
Expand All @@ -479,14 +463,6 @@ public WorldCoord getWorldCoord() {
return this.worldCoord;
}

/**
* @deprecated Deprecated as of 0.99.5.3, it is no longer possible to mutate the world/coordinates of a townblock.
*/
@Deprecated
public void setWorld(TownyWorld world) {

}

public TownyWorld getWorld() {

return this.worldCoord.getTownyWorld();
Expand Down
Loading
Loading