支持缓存玩家添加的点(最多20个)
This commit is contained in:
parent
f9394edefd
commit
ee78a96e14
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>site.deercloud</groupId>
|
||||
<artifactId>LiteWorldEdit</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<version>1.3-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>LiteWorldEdit</name>
|
||||
|
@ -38,7 +38,10 @@ public class Commands implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
Point point = new Point(x, y, z, player);
|
||||
LiteWorldEdit.instance.getCache().addPoint(player, index, point);
|
||||
if (!LiteWorldEdit.instance.getCache().addPoint(player, index, point)) {
|
||||
sender.sendMessage("点的数量不允许超过20,请使用已有点序号覆盖已有点。");
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage("点 " + index + " 已设置为 " + x + ", " + y + ", " + z + "。");
|
||||
} catch (NumberFormatException e) {
|
||||
sender.sendMessage("参数错误。");
|
||||
|
@ -23,11 +23,15 @@ public class Cache {
|
||||
_bars = new HashMap<String, BossBar>();
|
||||
}
|
||||
|
||||
public void addPoint(Player player, Integer index, Point point) {
|
||||
public boolean addPoint(Player player, Integer index, Point point) {
|
||||
if (!_points.containsKey(player.getUniqueId().toString())) {
|
||||
_points.put(player.getUniqueId().toString(), new HashMap<Integer, Point>());
|
||||
}
|
||||
if (_points.get(player.getUniqueId().toString()).size() >= 20) {
|
||||
return false;
|
||||
}
|
||||
_points.get(player.getUniqueId().toString()).put(index, point);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void addJob(Player player, Job job) {
|
||||
@ -63,7 +67,7 @@ public class Cache {
|
||||
}
|
||||
|
||||
public void deletePlayerCache(Player player) {
|
||||
_points.remove(player.getUniqueId().toString());
|
||||
// _points.remove(player.getUniqueId().toString());
|
||||
_jobs.remove(player.getUniqueId().toString());
|
||||
_bars.remove(player.getUniqueId().toString());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user