Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Commit

Permalink
Merge pull request #30 from McMoonLakeDev/v1.9-alpha
Browse files Browse the repository at this point in the history
v1.9 a3.1
  • Loading branch information
MoonLake authored Mar 29, 2017
2 parents d32053e + c406f5d commit abc8284
Show file tree
Hide file tree
Showing 23 changed files with 228 additions and 70 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# MoonLake [![GitHub version](https://d25lcipzij17d.cloudfront.net/badge.svg?id=gh&type=6&v=1.9-a3&x2=0)](https://github.com/u2g/MoonLake) [![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=102)](https://github.com/u2g/MoonLake) [![Open Source Love](https://badges.frapsoft.com/os/gpl/gpl.svg?v=102)](https://github.com/u2g/MoonLake)
# MoonLake [![GitHub version](https://d25lcipzij17d.cloudfront.net/badge.svg?id=gh&type=6&v=1.9-a3.1&x2=0)](https://github.com/u2g/MoonLake) [![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=102)](https://github.com/u2g/MoonLake) [![Open Source Love](https://badges.frapsoft.com/os/gpl/gpl.svg?v=102)](https://github.com/u2g/MoonLake)

Minecraft MoonLake Core API Plugin
By Month_Light Ver: 1.9-a3
By Month_Light Ver: 1.9-a3.1

## 简介
这个插件提供了大量的 API 功能,实现了一些 Bukkit 无法做到的 NMS 功能<br />
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.minecraft.moonlake</groupId>
<artifactId>MoonLake</artifactId>
<packaging>jar</packaging>
<version>1.9-a3</version>
<version>1.9-a3.1</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/minecraft/moonlake/MoonLakePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* <hr />
* <div>
* <h1>Minecraft MoonLake Core API Plugin</h1>
* <p>By Month_Light Ver: 1.9-a3</p>
* <p>By Month_Light Ver: 1.9-a3.1</p>
* <p>Website: <a href="http://www.mcyszh.com" target="_blank" style="text-decoration: none;">MoonLake Website</a></p>
* <p>QQ Group: 377607025 -> <a href="http://jq.qq.com/?_wv=1027&k=2IfPFrH" target="_blank">Jump</a></p>
* <hr />
Expand Down Expand Up @@ -65,7 +65,7 @@
* <h1>修改操作请您遵守 <a href="https://github.com/u2g/MoonLake/blob/master/LICENSE" target="_blank">GPLv3</a> 协议,您必须公开修改过的所有代码!</h1>
* </div>
*
* @version 1.9-a3
* @version 1.9-a3.1
* @author Month_Light
*/
public class MoonLakePlugin extends JavaPlugin implements MoonLake {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

import com.minecraft.moonlake.api.annotation.plugin.command.*;
import com.minecraft.moonlake.api.annotation.plugin.command.exception.*;
import com.minecraft.moonlake.api.nms.exception.NMSException;
import com.minecraft.moonlake.api.player.MoonLakePlayer;
import com.minecraft.moonlake.exception.MoonLakeException;
import com.minecraft.moonlake.manager.PlayerManager;
import com.minecraft.moonlake.nms.exception.NMSException;
import com.minecraft.moonlake.validate.Validate;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

package com.minecraft.moonlake.api.anvil;

import com.minecraft.moonlake.api.nms.exception.NMSException;
import com.minecraft.moonlake.api.player.MoonLakePlayer;
import com.minecraft.moonlake.nms.exception.NMSException;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
package com.minecraft.moonlake.api.anvil;

import com.minecraft.moonlake.api.event.MoonLakeListener;
import com.minecraft.moonlake.api.nms.exception.NMSException;
import com.minecraft.moonlake.api.player.MoonLakePlayer;
import com.minecraft.moonlake.event.EventHelper;
import com.minecraft.moonlake.manager.PlayerManager;
import com.minecraft.moonlake.nms.exception.NMSException;
import com.minecraft.moonlake.validate.Validate;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

package com.minecraft.moonlake.api.anvil;

import com.minecraft.moonlake.nms.exception.NMSException;
import com.minecraft.moonlake.api.nms.exception.NMSException;
import com.minecraft.moonlake.validate.Validate;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@

package com.minecraft.moonlake.api.event;

public interface Cancellable extends org.bukkit.event.Cancellable, Cloneable {
public interface Cancellable extends org.bukkit.event.Cancellable {
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
* </div>
* <hr />
*
* @version 1.0
* @version 1.1
* @author Month_Light
* @see TextualComponent
* @see FancyMessageFactory
Expand Down Expand Up @@ -212,7 +212,7 @@ public interface FancyMessage extends JsonRepresentedObject, Cloneable, Iterable
* @see FancyMessage#text(String)
* @see FancyMessage#text(TextualComponent)
* @throws IllegalArgumentException 如果最后一个花式消息对象没有文本内容则抛出异常
* @deprecated 如果忘记设置这个花式消息对象的消息接下来的操作可能会抛出异常
* @deprecated 已过时, 将于 v1.9-a5 删除. 请使用 {@link #then(String)}. 如果忘记设置这个花式消息对象的消息接下来的操作可能会抛出异常
*/
@Deprecated
FancyMessage then();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@
* <h1>FancyMessage Implement Class</h1>
* 花式消息接口实现类
*
* @version 1.0
* @version 1.2
* @author Month_Light
*/
class FancyMessageExpression implements FancyMessage {

private BooleanProperty dirty;
private StringProperty jsonString;
private ObjectProperty<List<FancyMessagePart>> partList;
private List<FancyMessagePart> partList;

/**
* 花式消息实现类构造函数
Expand Down Expand Up @@ -80,16 +80,16 @@ public FancyMessageExpression(String text) {
*/
public FancyMessageExpression(TextualComponent text) {

this.partList = new SimpleObjectProperty<>(new ArrayList<>());
this.partList.get().add(new FancyMessagePart(text));
this.partList = new ArrayList<>();
this.partList.add(new FancyMessagePart(text));
this.jsonString = new SimpleStringProperty(null);
this.dirty = new SimpleBooleanProperty(false);
}

@Override
public void writeJson(JsonWrite jsonWrite) throws IOException {

if (partList.get().size() == 1) {
if (partList.size() == 1) {

getLast().writeJson(jsonWrite);
}
Expand All @@ -108,7 +108,7 @@ public void writeJson(JsonWrite jsonWrite) throws IOException {
@Override
public Iterator<FancyMessagePart> iterator() {

return partList.get().iterator();
return partList.iterator();
}

@Override
Expand All @@ -122,7 +122,7 @@ public FancyMessage text(TextualComponent text) {

FancyMessagePart laster = getLast();

laster.text.set(text);
laster.text = text;

dirty.set(true);

Expand All @@ -134,7 +134,7 @@ public FancyMessage color(ChatColor color) {

Validate.isTrue(color.isColor(), "The fancy message chatcolor type not is color.");

getLast().color.set(color);
getLast().color = color;

dirty.set(true);

Expand All @@ -146,7 +146,7 @@ public FancyMessage style(FancyMessageStyle... style) {

Validate.notNull(style, "The fancy message style object is null.");

getLast().styles.get().addAll(Arrays.asList(style));
getLast().styles.addAll(Arrays.asList(style));

dirty.set(true);

Expand Down Expand Up @@ -289,7 +289,7 @@ public FancyMessage translationReplacements(String... replacements) {

for (final String str : replacements) {

getLast().translationReplacements.get().add(new FancyJsonString(str));
getLast().translationReplacements.add(new FancyJsonString(str));
}
dirty.set(true);

Expand All @@ -303,7 +303,7 @@ public FancyMessage translationReplacements(FancyMessage... replacements) {

for (final FancyMessage fancyMessage : replacements) {

getLast().translationReplacements.get().add(fancyMessage);
getLast().translationReplacements.add(fancyMessage);
}
dirty.set(true);

Expand All @@ -316,7 +316,7 @@ public FancyMessage then() {

Validate.isTrue(getLast().hasText(), "The fancy message part last not has text.");

partList.get().add(new FancyMessagePart());
partList.add(new FancyMessagePart());
dirty.set(true);

return this;
Expand All @@ -333,7 +333,7 @@ public FancyMessage then(TextualComponent text) {

Validate.isTrue(getLast().hasText(), "The fancy message part last not has text.");

partList.get().add(new FancyMessagePart(text));
partList.add(new FancyMessagePart(text));
dirty.set(true);

return this;
Expand All @@ -349,7 +349,7 @@ public FancyMessage join(FancyMessage fancyMessage) {

while(iterator.hasNext()) {

partList.get().add(iterator.next());
partList.add(iterator.next());
}
return this;
}
Expand Down Expand Up @@ -427,7 +427,7 @@ public void sendAll() {

protected FancyMessagePart getLast() {

return partList.get().get(partList.get().size() - 1);
return partList.get(partList.size() - 1);
}

private void onClick(String name, String data) {
Expand All @@ -445,7 +445,7 @@ private void onHover(String name, JsonRepresentedObject data) {
FancyMessagePart last = getLast();

last.hoverAction.set(name);
last.hoverActionValue.set(data);
last.hoverActionValue = data;

dirty.set(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

import com.minecraft.moonlake.json.JsonRepresentedObject;
import com.minecraft.moonlake.json.JsonWrite;
import com.minecraft.moonlake.property.ObjectProperty;
import com.minecraft.moonlake.property.SimpleObjectProperty;
import com.minecraft.moonlake.property.SimpleStringProperty;
import com.minecraft.moonlake.property.StringProperty;
import org.bukkit.ChatColor;
Expand All @@ -33,16 +31,16 @@
* <h1>FancyMessagePart</h1>
* 花式消息部分实现类
*
* @version 1.0
* @version 1.1
* @author Month_Light
*/
class FancyMessagePart implements JsonRepresentedObject, Cloneable {

ObjectProperty<ChatColor> color;
ObjectProperty<TextualComponent> text;
ObjectProperty<List<FancyMessageStyle>> styles;
ObjectProperty<JsonRepresentedObject> hoverActionValue;
ObjectProperty<List<JsonRepresentedObject>> translationReplacements;
ChatColor color;
TextualComponent text;
List<FancyMessageStyle> styles;
JsonRepresentedObject hoverActionValue;
List<JsonRepresentedObject> translationReplacements;
StringProperty clickAction, clickActionValue, hoverAction, insertion;

/**
Expand All @@ -60,11 +58,11 @@ public FancyMessagePart() {
*/
public FancyMessagePart(TextualComponent text) {

this.text = new SimpleObjectProperty<>(text);
this.color = new SimpleObjectProperty<>(ChatColor.WHITE);
this.styles = new SimpleObjectProperty<>(new ArrayList<>());
this.hoverActionValue = new SimpleObjectProperty<>(null);
this.translationReplacements = new SimpleObjectProperty<>(new ArrayList<>());
this.text = text;
this.color = ChatColor.WHITE;
this.styles = new ArrayList<>();
this.hoverActionValue = null;
this.translationReplacements = new ArrayList<>();
this.clickAction = new SimpleStringProperty(null);
this.clickActionValue = new SimpleStringProperty(null);
this.hoverAction = new SimpleStringProperty(null);
Expand All @@ -77,10 +75,10 @@ public void writeJson(JsonWrite jsonWrite) {
try {

jsonWrite.beginObject();
text.get().writeJson(jsonWrite);
jsonWrite.name("color").value(color.get().name().toLowerCase());
text.writeJson(jsonWrite);
jsonWrite.name("color").value(color.name().toLowerCase());

for (final FancyMessageStyle style : styles.get()) {
for (final FancyMessageStyle style : styles) {

jsonWrite.name(style.getType().toLowerCase()).value(true);
}
Expand All @@ -98,18 +96,18 @@ public void writeJson(JsonWrite jsonWrite) {
.beginObject()
.name("action").value(hoverAction.get())
.name("value");
hoverActionValue.get().writeJson(jsonWrite);
hoverActionValue.writeJson(jsonWrite);
jsonWrite.endObject();
}
if (insertion.get() != null) {

jsonWrite.name("insertion").value(insertion.get());
}
if (translationReplacements.get().size() > 0 && text.get() != null && TextualComponent.isTranslatableText(text.get())) {
if (translationReplacements.size() > 0 && text != null && TextualComponent.isTranslatableText(text)) {

jsonWrite.name("with").beginArray();

for (JsonRepresentedObject obj : translationReplacements.get()) {
for (JsonRepresentedObject obj : translationReplacements) {

obj.writeJson(jsonWrite);
}
Expand All @@ -130,6 +128,6 @@ public void writeJson(JsonWrite jsonWrite) {
*/
boolean hasText() {

return text.get() != null;
return text != null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public ItemBuilderWrapped(ItemStack itemStack) {
Validate.notNull(itemStack, "The itemstack object is null.");

this.itemStack = itemStack;
this.itemLibrary = ItemLibraryFactory.get().item();
this.itemLibrary = ItemLibraryFactorys.item();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.bukkit.inventory.ItemStack;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

Expand Down Expand Up @@ -705,6 +706,18 @@ public Set<String> getLores(ItemStack itemStack, boolean ignoreColor) {
return base.getLores(itemStack, ignoreColor);
}

@Override
public List<String> getLore(ItemStack itemStack) {

return base.getLore(itemStack);
}

@Override
public List<String> getLore(ItemStack itemStack, boolean ignoreColor) {

return base.getLore(itemStack, ignoreColor);
}

@Override
public ItemStack setLore(ItemStack itemStack, String... lore) {

Expand Down
Loading

0 comments on commit abc8284

Please sign in to comment.