Skip to content

Commit

Permalink
chore: pre-commit linting
Browse files Browse the repository at this point in the history
  • Loading branch information
sekwah41 committed Sep 7, 2024
1 parent 0b46fd6 commit 4c7a7c8
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ public boolean entityPortalEvent(EntityContainer entity) {
}

public boolean physicsEvent(BlockLocation blockLocation, String string) {
return !configRepository.getDisablePhysicsEvents() || !portalServices.inPortalRegionProtected(blockLocation);
return !configRepository.getDisablePhysicsEvents()
|| !portalServices.inPortalRegionProtected(blockLocation);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ public List<String> onTabComplete(CommandSenderContainer sender,
String baseString = endsWithSplit
? argData
: argData.substring(
0,
argData.lastIndexOf(multiTagSplit) + 1);
0,
argData.lastIndexOf(multiTagSplit)
+ 1);

tagSuggestions =
tagSuggestions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ private <U> Object constructFromMappingNode(Class<U> currentClass,
}
} catch (Exception e) {
infoLogger.warning("Failed to set field " + field.getName()
+ " in " + currentClass.getName() + ": "
+ e.getMessage());
+ " in " + currentClass.getName()
+ ": " + e.getMessage());
infoLogger.error(e);
throw new RuntimeException("Failed to set field "
+ field.getName() + " in "
Expand Down Expand Up @@ -193,7 +193,6 @@ private Map<String, Object> mapMappingNode(Class<?> currentClass,
*/
private void setField(Object instance, Field field, Object value)
throws IllegalAccessException {

// Check for numeric type compatibility and cast if necessary
if (field.getType() == float.class &&value instanceof Double) {
value = ((Double) value).floatValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public boolean preActivated(TagTarget target, PlayerContainer player,
ActivationData activeData, String[] argData) {
var commandPortals = configRepository.getCommandPortals();

if(!commandPortals.enabled) {
if (!commandPortals.enabled) {
player.sendMessage(Lang.translate("messageprefix.negative")
+ Lang.translate("tag.command.disabled"));
+ Lang.translate("tag.command.disabled"));
return false;
}

Expand All @@ -60,22 +60,26 @@ public boolean preActivated(TagTarget target, PlayerContainer player,
switch (executionCommand) {
case '!':
if (!commandPortals.op) {
player.sendMessage(Lang.translate("messageprefix.negative")
+ Lang.translate("tag.command.op.disabled"));
player.sendMessage(
Lang.translate("messageprefix.negative")
+ Lang.translate("tag.command.op.disabled"));
return false;
}
break;
case '#':
if (!commandPortals.console) {
player.sendMessage(Lang.translate("messageprefix.negative")
+ Lang.translate("tag.command.console.disabled"));
player.sendMessage(
Lang.translate("messageprefix.negative")
+ Lang.translate("tag.command.console.disabled"));
return false;
}
break;
case '^':
if (!commandPortals.permsWildcard) {
player.sendMessage(Lang.translate("messageprefix.negative")
+ Lang.translate("tag.command.permswildcard.disabled"));
player.sendMessage(
Lang.translate("messageprefix.negative")
+ Lang.translate(
"tag.command.permswildcard.disabled"));
return false;
}
break;
Expand Down Expand Up @@ -134,9 +138,9 @@ public boolean created(TagTarget target, PlayerContainer player,
String[] argData) {
if (argData != null) {
var commandPortals = configRepository.getCommandPortals();
if(!commandPortals.enabled) {
if (!commandPortals.enabled) {
player.sendMessage(Lang.translate("messageprefix.negative")
+ Lang.translate("tag.command.disabled"));
+ Lang.translate("tag.command.disabled"));
return false;
}
for (String command : argData) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ public void writeUtf(String text) {
public void writeUtf(String text, int maxLength) {
if (text.length() > maxLength) {
throw new EncoderException("String too big (was " + text.length()
+ " characters, max " + maxLength + ")");
+ " characters, max " + maxLength
+ ")");
} else {
byte[] abyte = text.getBytes(StandardCharsets.UTF_8);
int i = getMaxEncodedUtfLength(maxLength);
if (abyte.length > i) {
throw new EncoderException("String too big (was " + abyte.length
+ " bytes encoded, max " + i + ")");
+ " bytes encoded, max " + i
+ ")");
} else {
this.writeVarInt(abyte.length);
this.writeBytes(abyte);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static ArrayList<DataTag> getTagsFromArgs(String[] args) {
currentIdentifier = arg.substring(0, colonIndex);
currentValue = new StringBuilder(arg.substring(colonIndex + 1));
inQuotes = currentValue.toString().startsWith("\"");
if(inQuotes) {
if (inQuotes) {
currentValue.deleteCharAt(0);
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@ public void onBlockPlace(BlockPlaceEvent event) {

@EventHandler(priority = EventPriority.HIGH)
public void onPhysicsEvent(BlockPhysicsEvent event) {
if (!coreListeners.physicsEvent(ContainerHelpers.toBlockLocation(
event.getBlock().getLocation()),
event.getBlock().getType().toString())) {
if (!coreListeners.physicsEvent(
ContainerHelpers.toBlockLocation(
event.getBlock().getLocation()),
event.getBlock().getType().toString())) {
event.setCancelled(true);
}
}
Expand Down

0 comments on commit 4c7a7c8

Please sign in to comment.