Skip to content

Commit 1ea16a7

Browse files
committed
removed deprecated functions
1 parent e4ee8b7 commit 1ea16a7

File tree

10 files changed

+4
-345
lines changed

10 files changed

+4
-345
lines changed

src/java/de/ntcomputer/minecraft/controllablemobs/api/ControllableMob.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* You can retrieve an instance of ControllableMob by using the {@link ControllableMobs} class.
99
*
1010
* @author Cybran
11-
* @version v4
11+
* @version v5
1212
*
1313
* @param <E> the bukkit entity class of the entity which is being controlled.
1414
*/
@@ -21,13 +21,6 @@ public interface ControllableMob<E extends LivingEntity> {
2121
*/
2222
public E getEntity();
2323

24-
/**
25-
* @return the property management object for this ControllableMob.
26-
* @deprecated use {@link ControllableMob#getAttributes()} instead.
27-
*/
28-
@Deprecated
29-
public ControllableMobProperties getProperties();
30-
3124
/**
3225
* @return the attribute management object for this ControllableMob.
3326
*/

src/java/de/ntcomputer/minecraft/controllablemobs/api/ControllableMobAI.java

Lines changed: 1 addition & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,10 @@
1111
* You can retrieve an instance by using {@link ControllableMob#getAI()}
1212
*
1313
* @author Cybran
14-
* @version v4
14+
* @version v5
1515
*/
1616
public interface ControllableMobAI<E extends LivingEntity> {
1717

18-
/**
19-
* Adds a given AI behavior - the entity will act corresponding to this behavior.
20-
* AI behaviors are persistent, if you add them one time, they will stay active until you remove them.
21-
* AI behaviors start certain actions automatically, defined by the behavior you add.
22-
* You can retrieve an AI behavior instance by creating a subclass of {@link AIBehavior}.
23-
* You must not add a behavior more than one time.
24-
*
25-
* @param behavior the new AI behavior
26-
* @throws IllegalArgumentException when behavior is null or has already been added
27-
*
28-
* @deprecated changed to {@link ControllableMobAI#addBehavior(AIBehavior)}. Method will be removed in v5.
29-
*/
30-
@SuppressWarnings("rawtypes")
31-
@Deprecated
32-
public void addAIBehavior(AIBehavior behavior) throws IllegalArgumentException;
33-
3418
/**
3519
* Adds a given AI behavior - the entity will act corresponding to this behavior.<br>
3620
* AI behaviors start certain actions automatically, defined by the behavior you add.<br>
@@ -43,18 +27,6 @@ public interface ControllableMobAI<E extends LivingEntity> {
4327
*/
4428
public <B extends AIBehavior<? super E>> AIPart<E,B> addBehavior(B behavior) throws IllegalArgumentException;
4529

46-
/**
47-
* Adds the given AI behaviors.
48-
*
49-
* @see ControllableMobAI#addAIBehavior(AIBehavior)
50-
* @param behaviors an array of new AI behaviors
51-
* @throws IllegalArgumentException when behaviors is null or contains null
52-
*
53-
* @deprecated changed to {@link ControllableMobAI#addBehaviors(AIBehavior...)}. Method will be removed in v5.
54-
*/
55-
@SuppressWarnings("rawtypes")
56-
public void addAIBehaviors(AIBehavior[] behaviors) throws IllegalArgumentException;
57-
5830
/**
5931
* Adds the given AI behaviors.
6032
*
@@ -65,19 +37,6 @@ public interface ControllableMobAI<E extends LivingEntity> {
6537
*/
6638
public AIPart<E,?>[] addBehaviors(AIBehavior<? super E>... behaviors) throws IllegalArgumentException;
6739

68-
/**
69-
* Removes the given AI behavior.<br>
70-
* The behavior must have been added manually before.
71-
*
72-
* @param behavior the AI behavior to remove. Be sure, that the instance was previously added by {@link ControllableMobAI#addAIBehavior(AIBehavior)}
73-
* @throws IllegalArgumentException when behavior is null
74-
*
75-
* @deprecated removing parts of the AI by passing the behavior is deprecated. You should switch to {@link de.ntcomputer.minecraft.controllablemobs.api.ai.AIPart#unattach()}. Method will be removed in v5 or v6.
76-
*/
77-
@SuppressWarnings("rawtypes")
78-
@Deprecated
79-
public void removeAIBehavior(AIBehavior behavior) throws IllegalArgumentException;
80-
8140
/**
8241
* Unattaches all AI parts of the specified types.<br>
8342
* You are free to re-attach any of the removed AI parts later.
@@ -94,51 +53,20 @@ public interface ControllableMobAI<E extends LivingEntity> {
9453
*/
9554
public void removeExcept(AIType... typesToKeep);
9655

97-
/**
98-
* Removes all AI behaviors.<br>
99-
* Removes custom, manually added behaviors as well as default behaviors.<br>
100-
* The result: the entity will not move nor attack automatically.
101-
*
102-
* @deprecated renamed to {@link ControllableMobAI#clear()}. Method will be removed in v5.
103-
*/
104-
@Deprecated
105-
public void clearAIBehaviors();
106-
10756
/**
10857
* Removes all AI behaviors.<br>
10958
* Removes custom, manually added behaviors as well as default behaviors.<br>
11059
* The result: the entity will not move nor attack automatically.
11160
*/
11261
public void clear();
11362

114-
/**
115-
* Restores all default AI behaviors.
116-
* Removes custom, manually added behaviors and restores the default behaviors for this entity.
117-
* The result: the entity will act normal.
118-
*
119-
* @deprecated renamed to {@link ControllableMobAI#reset()}. Method will be removed in v5.
120-
*/
121-
@Deprecated
122-
public void restoreAIBehaviors();
123-
12463
/**
12564
* Resets to default AI behaviors.<br>
12665
* Removes custom, manually added behaviors and restores the default behaviors for this entity.<br>
12766
* The result: the entity will act normal.
12867
*/
12968
public void reset();
13069

131-
/**
132-
* Retrieves all custom AI behaviors.
133-
*
134-
* @return an array of all custom AI behaviors (default AI behaviors are NOT included)
135-
*
136-
* @deprecated retrieving the AI by returning the behaviors is deprecated. You should switch to {@link ControllableMobAI#getParts()}. Method will be removed in v5 or v6.
137-
*/
138-
@SuppressWarnings("rawtypes")
139-
@Deprecated
140-
public AIBehavior[] getAIBehaviors();
141-
14270
/**
14371
* Retrieves all AI parts, including custom behaviors and default behaviors.
14472
*

src/java/de/ntcomputer/minecraft/controllablemobs/api/ControllableMobActions.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* You can retrieve an instance by using {@link ControllableMob#getActions()}
1414
*
1515
* @author Cybran
16-
* @version v3
16+
* @version v5
1717
*/
1818
public interface ControllableMobActions {
1919
/**
@@ -235,12 +235,6 @@ public interface ControllableMobActions {
235235
*/
236236
public ControllableMobAction callback(Runnable runnable);
237237

238-
/*public ControllableMobAction teleport(Entity entity);
239-
public ControllableMobAction teleport(Entity entity, boolean queue);
240-
public ControllableMobAction teleport(Entity entity, boolean queue, float targetDistance);
241-
public ControllableMobAction teleport(Location loc);
242-
public ControllableMobAction teleport(Location loc, boolean queue);*/
243-
244238

245239
/**
246240
* Returns whether an action of the specified type is currently running.

src/java/de/ntcomputer/minecraft/controllablemobs/api/ControllableMobProperties.java

Lines changed: 0 additions & 54 deletions
This file was deleted.

src/java/de/ntcomputer/minecraft/controllablemobs/api/ControllableMobs.java

Lines changed: 1 addition & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@
1111
import org.bukkit.plugin.Plugin;
1212
import org.bukkit.plugin.java.PluginClassLoader;
1313

14-
import de.ntcomputer.minecraft.controllablemobs.api.ai.behaviors.AIBehavior;
1514
import de.ntcomputer.minecraft.controllablemobs.implementation.CraftControllableMob;
1615
import de.ntcomputer.minecraft.controllablemobs.implementation.nativeinterfaces.NativeInterfaces;
1716

1817
/**
1918
* This is a static class which lets you retrieve instances of {@link ControllableMob}.
2019
*
2120
* @author Cybran
22-
* @version v4
21+
* @version v5
2322
*
2423
*/
2524
public final class ControllableMobs {
@@ -141,78 +140,6 @@ public static <E extends LivingEntity> ControllableMob<E> assign(E entity, boole
141140
return controllableMob;
142141
}
143142

144-
/**
145-
* Puts the entity under your control and sets its new movement speed, optionally clearing its AI.
146-
* If you decide to clear its AI, the entity will stop moving and attacking and stand still until you order it to execute any actions.
147-
* See {@link ControllableMobAttributes#getMovementSpeedAttribute()} for critical information.
148-
*
149-
* @param entity entity an instance of a subclass of LivingEntity - the entity you want to control.
150-
* @param clearAI a boolean indicating whether default behaviors should be removed (true) or not (false)
151-
* @param newMovementSpeed This float value has to be in a range between 0.01 and 2.0, or it will be ignored. The default value is 0.25 for monsters
152-
* @return the {@link ControllableMob} you can use to control the entity
153-
* @throws InvalidEntityException when the entity is null or can't be controlled
154-
* @throws IllegalStateException when the entity is already being controlled
155-
*
156-
* @deprecated contains parameters that should be set elsewhere. Will be removed in v5 or v6.
157-
*/
158-
@Deprecated
159-
public static <E extends LivingEntity> ControllableMob<E> assign(E entity, boolean clearAI, float newMovementSpeed) throws IllegalStateException, InvalidEntityException {
160-
return assign(entity, clearAI, newMovementSpeed, null);
161-
}
162-
163-
/**
164-
* Puts the entity under your control, optionally clearing its AI and adding custom AI behaviors.
165-
* If you decide to clear its AI, the entity will stop moving and attacking like it would normally do.
166-
* Instead, it will act corresponding to the new AI behaviors you provide.
167-
*
168-
* @param entity entity an instance of a subclass of LivingEntity - the entity you want to control.
169-
* @param clearAI a boolean indicating whether default behaviors should be removed (true) or not (false)
170-
* @param additionalAIBehaviors an array of new AI behaviors. See {@link ControllableMobAI#addAIBehaviors(AIBehavior[])}
171-
* @return the {@link ControllableMob} you can use to control the entity
172-
* @throws InvalidEntityException when the entity is null or can't be controlled
173-
* @throws IllegalStateException when the entity is already being controlled
174-
*
175-
* @deprecated contains parameters that should be set elsewhere. Will be removed in v5 or v6.
176-
*/
177-
@SuppressWarnings("rawtypes")
178-
@Deprecated
179-
public static <E extends LivingEntity> ControllableMob<E> assign(E entity, boolean clearAI, AIBehavior[] additionalAIBehaviors) throws IllegalStateException, InvalidEntityException {
180-
return assign(entity, clearAI, 0, additionalAIBehaviors);
181-
}
182-
183-
/**
184-
* Puts the entity under your control and sets its new movement speed, optionally clearing its AI and adding custom AI behaviors.
185-
* If you decide to clear its AI, the entity will stop moving and attacking like it would normally do.
186-
* Instead, it will act corresponding to the new AI behaviors you provide.
187-
* See {@link ControllableMobAttributes#getMovementSpeedAttribute()} for critical information.
188-
*
189-
* @param entity entity an instance of a subclass of LivingEntity - the entity you want to control.
190-
* @param clearAI a boolean indicating whether default behaviors should be removed (true) or not (false)
191-
* @param newMovementSpeed This float value has to be in a range between 0.01 and 2.0, or it will be ignored. The default value is 0.25 for monsters
192-
* @param additionalAIBehaviors an array of new AI behaviors. See {@link ControllableMobAI#addAIBehaviors(AIBehavior[])}
193-
* @return the {@link ControllableMob} you can use to control the entity
194-
* @throws InvalidEntityException when the entity is null or can't be controlled
195-
* @throws IllegalStateException when the entity is already being controlled
196-
*
197-
* @deprecated contains parameters that should be set elsewhere. Will be removed in v5 or v6.
198-
*/
199-
@SuppressWarnings("rawtypes")
200-
@Deprecated
201-
public static <E extends LivingEntity> ControllableMob<E> assign(E entity, boolean clearAI, float newMovementSpeed, AIBehavior[] additionalAIBehaviors) throws IllegalStateException, InvalidEntityException {
202-
if(entity==null) throw new InvalidEntityException("entity must not be null", entity);
203-
EntityLiving notchEntity = ((CraftLivingEntity) entity).getHandle();
204-
if(!(notchEntity instanceof EntityInsentient)) throw new InvalidEntityException("the entity "+entity.toString()+" can't be controlled",entity);
205-
if(entities.containsKey(entity)) throw new IllegalStateException("entity "+entity.toString()+" is already a controlled entity");
206-
207-
ControllableMob<E> controllableMob = new CraftControllableMob<E>(entity, (EntityInsentient) notchEntity);
208-
if(clearAI) controllableMob.getAI().clearAIBehaviors();
209-
controllableMob.getProperties().setMovementSpeed(newMovementSpeed);
210-
if(additionalAIBehaviors!=null) controllableMob.getAI().addAIBehaviors(additionalAIBehaviors);
211-
212-
entities.put(entity,controllableMob);
213-
return controllableMob;
214-
}
215-
216143
/**
217144
* Releases the entity from control and restores default behaviors.
218145
* All actions will be stopped immediately, all custom AI behaviors will be removed and default attributes and behaviors will be restored. Frees memory.

src/java/de/ntcomputer/minecraft/controllablemobs/implementation/CraftControllableMob.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,11 @@
88
import de.ntcomputer.minecraft.controllablemobs.api.ControllableMobAI;
99
import de.ntcomputer.minecraft.controllablemobs.api.ControllableMobActions;
1010
import de.ntcomputer.minecraft.controllablemobs.api.ControllableMobAttributes;
11-
import de.ntcomputer.minecraft.controllablemobs.api.ControllableMobProperties;
1211
import de.ntcomputer.minecraft.controllablemobs.implementation.actions.ControllableMobActionManager;
1312

14-
@SuppressWarnings("deprecation")
1513
public class CraftControllableMob<E extends LivingEntity> implements ControllableMob<E> {
1614
private E entity;
1715
private CraftControllableMobAttributes attributes;
18-
@Deprecated
19-
private CraftControllableMobProperties properties;
2016
private CraftControllableMobAI<E> ai;
2117
private CraftControllableMobActions actions;
2218
public EntityInsentient notchEntity;
@@ -25,7 +21,6 @@ public CraftControllableMob(E entity, EntityInsentient notchEntity) {
2521
this.entity = entity;
2622
this.notchEntity = notchEntity;
2723
this.attributes = new CraftControllableMobAttributes(this);
28-
this.properties = new CraftControllableMobProperties(this.attributes);
2924
this.actions = new CraftControllableMobActions(this);
3025
this.ai = new CraftControllableMobAI<E>(this);
3126
}
@@ -40,13 +35,11 @@ public void unassign(boolean resetAttributes) {
4035
// component dispose
4136
this.actions.dispose();
4237
this.ai.dispose();
43-
this.properties.dispose();
4438
this.attributes.dispose(resetAttributes);
4539

4640
// component disposal
4741
this.actions = null;
4842
this.ai = null;
49-
this.properties = null;
5043
this.attributes = null;
5144

5245
// entity unassign
@@ -68,13 +61,6 @@ public E getEntity() {
6861
return entity;
6962
}
7063

71-
@Override
72-
@Deprecated
73-
public ControllableMobProperties getProperties() throws IllegalStateException {
74-
if(this.properties==null) this.disposedCall();
75-
return this.properties;
76-
}
77-
7864
@Override
7965
public ControllableMobAI<E> getAI() {
8066
if(this.ai==null) this.disposedCall();

0 commit comments

Comments
 (0)