Skip to content

Commit

Permalink
Cleanup: fix a few typos and formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mkremins committed Jul 30, 2014
1 parent 86594b4 commit f168221
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 21 deletions.
18 changes: 9 additions & 9 deletions src/main/java/mkremins/fanciful/FancyMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

/**
* Represents a formattable message. Such messages can use elements such as colors, formatting codes, hover and click data, and other features provided by the vanilla Minecraft <a href="http://minecraft.gamepedia.com/Tellraw#Raw_JSON_Text">JSON message formatter</a>.
* This class allows plugins to emulate the functionality of the vanilla minecraft <a href="http://minecraft.gamepedia.com/Commands#tellraw">tellraw command</a>.
* This class allows plugins to emulate the functionality of the vanilla Minecraft <a href="http://minecraft.gamepedia.com/Commands#tellraw">tellraw command</a>.
* <p>
* This class follows the builder pattern, allowing for method chaining.
* It is set up such that invocations of property-setting methods will affect the current editing component,
Expand Down Expand Up @@ -87,10 +87,10 @@ public FancyMessage(final TextualComponent firstPartText) {
nmsPacketPlayOutChatConstructor = Reflection.getNMSClass("PacketPlayOutChat").getDeclaredConstructor(Reflection.getNMSClass("IChatBaseComponent"));
nmsPacketPlayOutChatConstructor.setAccessible(true);
} catch (NoSuchMethodException e) {
Bukkit.getLogger().log(Level.SEVERE, "Could not find mincraft method or constructor.", e);
Bukkit.getLogger().log(Level.SEVERE, "Could not find Minecraft method or constructor.", e);
} catch (SecurityException e) {
Bukkit.getLogger().log(Level.WARNING, "Could not access constructor.", e);
}
Bukkit.getLogger().log(Level.WARNING, "Could not access constructor.", e);
}
}
}

Expand Down Expand Up @@ -223,7 +223,7 @@ public FancyMessage achievementTooltip(final Achievement which) {
Object achievement = Reflection.getMethod(Reflection.getOBCClass("CraftStatistic"), "getNMSAchievement", Achievement.class).invoke(null, which);
return achievementTooltip((String) Reflection.getField(Reflection.getNMSClass("Achievement"), "name").get(achievement));
} catch (IllegalAccessException e) {
Bukkit.getLogger().log(Level.WARNING, "Could not access methode.", e);
Bukkit.getLogger().log(Level.WARNING, "Could not access method.", e);
return this;
} catch (IllegalArgumentException e) {
Bukkit.getLogger().log(Level.WARNING, "Argument could not be passed.", e);
Expand All @@ -250,7 +250,7 @@ public FancyMessage statisticTooltip(final Statistic which) {
Object statistic = Reflection.getMethod(Reflection.getOBCClass("CraftStatistic"), "getNMSStatistic", Statistic.class).invoke(null, which);
return achievementTooltip((String) Reflection.getField(Reflection.getNMSClass("Statistic"), "name").get(statistic));
} catch (IllegalAccessException e) {
Bukkit.getLogger().log(Level.WARNING, "Could not access methode.", e);
Bukkit.getLogger().log(Level.WARNING, "Could not access method.", e);
return this;
} catch (IllegalArgumentException e) {
Bukkit.getLogger().log(Level.WARNING, "Argument could not be passed.", e);
Expand Down Expand Up @@ -281,7 +281,7 @@ public FancyMessage statisticTooltip(final Statistic which, Material item) {
Object statistic = Reflection.getMethod(Reflection.getOBCClass("CraftStatistic"), "getMaterialStatistic", Statistic.class, Material.class).invoke(null, which, item);
return achievementTooltip((String) Reflection.getField(Reflection.getNMSClass("Statistic"), "name").get(statistic));
} catch (IllegalAccessException e) {
Bukkit.getLogger().log(Level.WARNING, "Could not access methode.", e);
Bukkit.getLogger().log(Level.WARNING, "Could not access method.", e);
return this;
} catch (IllegalArgumentException e) {
Bukkit.getLogger().log(Level.WARNING, "Argument could not be passed.", e);
Expand Down Expand Up @@ -312,7 +312,7 @@ public FancyMessage statisticTooltip(final Statistic which, EntityType entity) {
Object statistic = Reflection.getMethod(Reflection.getOBCClass("CraftStatistic"), "getEntityStatistic", Statistic.class, EntityType.class).invoke(null, which, entity);
return achievementTooltip((String) Reflection.getField(Reflection.getNMSClass("Statistic"), "name").get(statistic));
} catch (IllegalAccessException e) {
Bukkit.getLogger().log(Level.WARNING, "Could not access methode.", e);
Bukkit.getLogger().log(Level.WARNING, "Could not access method.", e);
return this;
} catch (IllegalArgumentException e) {
Bukkit.getLogger().log(Level.WARNING, "Argument could not be passed.", e);
Expand Down Expand Up @@ -550,7 +550,7 @@ private void send(CommandSender sender, String jsonString){
} catch (IllegalArgumentException e) {
Bukkit.getLogger().log(Level.WARNING, "Argument could not be passed.", e);
} catch (IllegalAccessException e) {
Bukkit.getLogger().log(Level.WARNING, "Could not access methode.", e);
Bukkit.getLogger().log(Level.WARNING, "Could not access method.", e);
} catch (InstantiationException e) {
Bukkit.getLogger().log(Level.WARNING, "Underlying class is abstract.", e);
} catch (InvocationTargetException e) {
Expand Down
22 changes: 10 additions & 12 deletions src/main/java/mkremins/fanciful/TextualComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public abstract class TextualComponent implements Cloneable {
ConfigurationSerialization.registerClass(TextualComponent.ComplexTextTypeComponent.class);
}

@Override
@Override
public String toString() {
return getReadableString();
}
Expand Down Expand Up @@ -103,7 +103,6 @@ public void setValue(String value) {
private String _value;

@Override
@SuppressWarnings("CloneDoesntCallSuperClone")
public TextualComponent clone() throws CloneNotSupportedException {
// Since this is a private and final class, we can just reinstantiate this class instead of casting super.clone
return new ArbitraryTextTypeComponent(getKey(), getValue());
Expand All @@ -126,10 +125,10 @@ public static ArbitraryTextTypeComponent deserialize(Map<String, Object> map){
return new ArbitraryTextTypeComponent(map.get("key").toString(), map.get("value").toString());
}

@Override
public String getReadableString() {
return getValue();
}
@Override
public String getReadableString() {

This comment has been minimized.

Copy link
@MiniDigger

MiniDigger Jul 30, 2014

Contributor

Doesn't this has to be indented?

This comment has been minimized.

Copy link
@killje

killje Jul 30, 2014

Contributor

yes, i dont know why it hasnt, but i saw that mkremins has fixed those indent issues i had

This comment has been minimized.

Copy link
@mkremins

mkremins Jul 30, 2014

Author Owner

Looks like I missed this one. I'm planning to autoformat the source and fix all the style issues pretty soon, so I'll let it sit for now.

return getValue();
}
}

/**
Expand Down Expand Up @@ -166,7 +165,6 @@ public void setValue(Map<String, String> value) {
private Map<String, String> _value;

@Override
@SuppressWarnings("CloneDoesntCallSuperClone")
public TextualComponent clone() throws CloneNotSupportedException {
// Since this is a private and final class, we can just reinstantiate this class instead of casting super.clone
return new ComplexTextTypeComponent(getKey(), getValue());
Expand Down Expand Up @@ -204,11 +202,11 @@ public static ComplexTextTypeComponent deserialize(Map<String, Object> map){
}
return new ComplexTextTypeComponent(key, value);
}
@Override
public String getReadableString() {
return getKey();
}
@Override
public String getReadableString() {
return getKey();
}
}

/**
Expand Down

0 comments on commit f168221

Please sign in to comment.