Skip to content

Commit

Permalink
Update some deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
PseudoKnight committed May 25, 2017
1 parent 8a2c895 commit efcb84f
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 91 deletions.
5 changes: 0 additions & 5 deletions src/main/java/com/laytonsmith/abstraction/MCEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ public interface MCEntity extends MCMetadatable {

public boolean eject();

public void fireEntityDamageEvent(MCDamageCause dc);

@Deprecated
int getEntityId();

public float getFallDistance();

public int getFireTicks();
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/com/laytonsmith/abstraction/MCPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ public interface MCPlayer extends MCCommandSender, MCHumanEntity,

public void resetPlayerWeather();

public void sendTexturePack(String url);

public void sendResourcePack(String url);

public void setAllowFlight(boolean flight);
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/laytonsmith/abstraction/MCScore.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/
public interface MCScore {
public MCObjective getObjective();
public MCOfflinePlayer getPlayer();
public int getScore();
public MCScoreboard getScoreboard();
public void setScore(int score);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ public MCObjective getObjective() {
return new BukkitMCObjective(s.getObjective());
}

@Override
public MCOfflinePlayer getPlayer() {
return new BukkitMCOfflinePlayer(s.getPlayer());
}

@Override
public int getScore() {
return s.getScore();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,6 @@ public boolean eject() {
return e.eject();
}

@Override
public void fireEntityDamageEvent(MCDamageCause dc) {
EntityDamageEvent ede = new EntityDamageEvent(e, EntityDamageEvent.DamageCause.valueOf(dc.name()), 9001.0);
CommandHelperPlugin.self.getServer().getPluginManager().callEvent(ede);
}

@Override
public int getEntityId() {
return e.getEntityId();
}

@Override
public float getFallDistance() {
return e.getFallDistance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@

import com.laytonsmith.abstraction.entities.MCFishHook;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Fish;
import org.bukkit.entity.FishHook;

public class BukkitMCFishHook extends BukkitMCProjectile implements MCFishHook {

Fish f;
FishHook f;

public BukkitMCFishHook(Entity e) {
super(e);
f = (Fish) e;
f = (FishHook) e;
}

@Override
public double getBiteChance() {
// only works pre-1.9
return f.getBiteChance();
}

@Override
public void setBiteChance(double chance) {
// only works pre-1.9
f.setBiteChance(chance);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,8 @@ public void sendMessage(String string) {
p.sendMessage(string);
}

@Override
public void sendTexturePack(String url) {
p.setTexturePack(url);
}

@Override
public void sendResourcePack(String url) {
@Override
public void sendResourcePack(String url) {
p.setResourcePack(url);
}

Expand Down Expand Up @@ -370,13 +365,6 @@ public void setFlying(boolean flight) {
p.setFlying(flight);
}

/*public void setHealth(int i) {
if(i == 0){
this.fireEntityDamageEvent(MCDamageCause.CUSTOM);
}
p.setHealth(i);
}*/

@Override
public void setLevel(int xp) {
p.setLevel(xp);
Expand Down Expand Up @@ -495,7 +483,7 @@ public String getPlayerListName() {
public boolean isNewPlayer() {
//Note the reversed logic here. If they have NOT played before, they are
//a new player.
return !p.getServer().getOfflinePlayer(p.getName()).hasPlayedBefore();
return !p.hasPlayedBefore();
}

@Override
Expand Down
42 changes: 0 additions & 42 deletions src/main/java/com/laytonsmith/core/Static.java
Original file line number Diff line number Diff line change
Expand Up @@ -813,24 +813,6 @@ public static int Normalize(int i, int min, int max) {
return java.lang.Math.min(max, java.lang.Math.max(min, i));
}

/**
* Returns the entity with the specified id. If it doesn't exist, a
* ConfigRuntimeException is thrown.
*
* @param id
* @return
*/
public static MCEntity getEntity(int id, Target t) {
for (MCWorld w : getServer().getWorlds()) {
for (MCEntity e : w.getEntities()) {
if (e.getEntityId() == id) {
return StaticLayer.GetCorrectEntity(e);
}
}
}
throw new CREBadEntityException("That entity (ID " + id + ") does not exist.", t);
}

public static MCEntity getEntity(Construct id, Target t) {
return getEntityByUuid(GetUUID(id.val(), t), t);
}
Expand Down Expand Up @@ -880,30 +862,6 @@ public static MCLivingEntity getLivingByUUID(UUID id, Target t) {
throw new CREBadEntityException("That entity (" + id + ") does not exist or is not alive.", t);
}

/**
* Returns the living entity with the specified id. If it doesn't exist or isn't living, a ConfigRuntimeException is
* thrown.
*
* @param id
*
* @return
*/
public static MCLivingEntity getLivingEntity(int id, Target t) {
for (MCWorld w : Static.getServer().getWorlds()) {
for (MCLivingEntity e : w.getLivingEntities()) {
if (e.getEntityId() == id) {
try {
return (MCLivingEntity) StaticLayer.GetCorrectEntity(e);
} catch (ClassCastException cce) {
throw new CREBadEntityException("The entity found was misinterpreted by the converter, this is"
+ " a developer mistake, please file a ticket.", t);
}
}
}
}
throw new CREBadEntityException("That entity (" + id + ") does not exist or is not alive.", t);
}

/**
* Returns all vehicles from all maps.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2035,7 +2035,7 @@ public String docs() {
+ " Fires when a player casts or reels a fishing rod."
+ " {player | world | state | chance | xp | hook: the fishhook entity id"
+ " | caught: the id of the snared entity, can be a fish item}"
+ " {chance: the chance of catching a fish from pulling the bobber at random"
+ " {chance: the chance of catching a fish from pulling the bobber at random (pre 1.9 only)"
+ " | xp: the exp the player will get from catching a fish}"
+ " {}";
}
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/com/laytonsmith/core/functions/Minecraft.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.laytonsmith.abstraction.enums.MCWolfType;
import com.laytonsmith.abstraction.enums.MCZombieType;
import com.laytonsmith.annotations.api;
import com.laytonsmith.annotations.hide;
import com.laytonsmith.core.CHVersion;
import com.laytonsmith.core.ObjectGenerator;
import com.laytonsmith.core.Optimizable;
Expand Down Expand Up @@ -1340,6 +1341,8 @@ public CHVersion since() {
}

@api
@hide("Deprecated in favor of send_resourcepack")
@Deprecated
public static class send_texturepack extends AbstractFunction {

@Override
Expand All @@ -1361,7 +1364,7 @@ public Boolean runAsync() {
public Construct exec(Target t, Environment environment,
Construct... args) throws ConfigRuntimeException {
MCPlayer p = Static.GetPlayer(args[0], t);
p.sendTexturePack(args[1].val());
p.sendResourcePack(args[1].val());
return CVoid.VOID;
}

Expand All @@ -1377,11 +1380,7 @@ public Integer[] numArgs() {

@Override
public String docs() {
return "void {player, url} Sends a texturepack URL to the player's client."
+ " If the client has not been requested to change textures in the"
+ " past, they will recieve a confirmation dialog before downloading"
+ " and switching to the new pack. Clients that ignore server textures"
+ " will not recieve the request, so this function will not affect them.";
return "void {player, url} Deprecated in favor of send_resourcepack().";
}

@Override
Expand Down

0 comments on commit efcb84f

Please sign in to comment.