Fix a few IDE warnings (#1345)
This commit is contained in:
1 parent
e011f65e75
commit
b1c934da28
19 files changed
+225
-350
No files matched your search
@@ -1,56 +0,0 @@
|
||||
package carpet.script.annotation;
|
||||
|
||||
import carpet.logging.HUDController;
|
||||
import carpet.script.annotation.Param.AllowSingleton;
|
||||
import carpet.script.exception.InternalExpressionException;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
/* There is no worse example to use for 1.17 compatibility
|
||||
import static net.minecraft.network.packet.s2c.play.TitleS2CPacket.Action;
|
||||
|
||||
public class FunctionsTestClass {
|
||||
@ScarpetFunction(maxParams = 6)
|
||||
public Integer display_title2(@AllowSingleton List<ServerPlayerEntity> targets, String actionString, Optional<Text> content, Integer... times) {
|
||||
TitleS2CPacket.Action action;
|
||||
switch (actionString.toLowerCase(Locale.ROOT))
|
||||
{
|
||||
case "title":
|
||||
action = Action.TITLE;
|
||||
break;
|
||||
case "subtitle":
|
||||
action = Action.SUBTITLE;
|
||||
break;
|
||||
case "actionbar":
|
||||
action = Action.ACTIONBAR;
|
||||
break;
|
||||
case "clear":
|
||||
action = Action.CLEAR;
|
||||
break;
|
||||
case "player_list_header":
|
||||
case "player_list_footer":
|
||||
action = null;
|
||||
break;
|
||||
default:
|
||||
throw new InternalExpressionException("'display_title' requires 'title', 'subtitle', 'actionbar', 'player_list_header', 'player_list_footer' or 'clear' as second argument");
|
||||
}
|
||||
if (action == null) // Player list
|
||||
{
|
||||
Map<String, BaseText> map = actionString.equals("player_list_header") ? HUDController.scarpet_headers : HUDController.scarpet_footers;
|
||||
if (!content.isPresent()) // null
|
||||
for (ServerPlayerEntity p : targets)
|
||||
map.remove(p.getEntityName());
|
||||
else
|
||||
for (ServerPlayerEntity p : targets)
|
||||
map.put(p.getEntityName(), (BaseText) content.get());
|
||||
return targets.size();
|
||||
}
|
||||
targets.forEach(p -> {
|
||||
if (times.length == 3) p.networkHandler.sendPacket(new TitleS2CPacket(Action.TIMES, null, times[0], times[1], times[2]));
|
||||
p.networkHandler.sendPacket(new TitleS2CPacket(action, content.orElse(null)));
|
||||
});
|
||||
return targets.size();
|
||||
}
|
||||
}
|
||||
*/
|
||||
Reference in new issue
Block a user