在主类中声明了一下
public static PlayerPoints playerPoints
然后就playerpoints.getAPI().look(player.getName())进行调用了
结果发现这行是Null的
用了player.getuuid也是一样
去官网看了点击API发现网页没了。。。。
是不是还应该加点什么?
public static PlayerPoints playerPoints
然后就playerpoints.getAPI().look(player.getName())进行调用了
结果发现这行是Null的
用了player.getuuid也是一样
去官网看了点击API发现网页没了。。。。
是不是还应该加点什么?
本帖最后由 V逍遥 于 2021-5-1 22:07 编辑
从playerName 更换为 UUID
复制代码
并确保UUID不是Null
从playerName 更换为 UUID
- public int look(UUID playerId)
并确保UUID不是Null
V逍遥 发表于 2021-5-1 22:05
从playerName 更换为 UUID
并确保UUID不是Null
- if(player.getUniqueId() != null){
- player.sendMessage("玩家UUID为" + player.getUniqueId() + "进行获取玩家点券");
- int look = Main.playerPoints.getAPI().look(player.getUniqueId());
- player.sendMessage("玩家点券" + look);
- } else {
- player.sendMessage("UUID为null");
- }
凉凉丶 发表于 2021-5-1 22:18
进行了上述测试,Main.playerPoints.getAPI().look(player.getUniqueId());这行依旧是null的报错
...
playerPoint实例化了吗?
PercyDan 发表于 2021-5-1 22:44
playerPoint实例化了吗?
在主类中 public static PlayerPoints playerpoints了
调用就是 Main.playerpoints.getAPI.get方法的
凉凉丶 发表于 2021-5-1 22:51
在主类中 public static PlayerPoints playerpoints了
调用就是 Main.playerpoints.getAPI.get方法的 ...
所以实例化了吗?
PercyDan 发表于 2021-5-1 22:51
所以实例化了吗?
没有23333 他没提供,也不知道咋去写他
PercyDan 发表于 2021-5-1 22:53
不实例化还想不报null,妈的绝了
我的问的时候就贴了我的步骤的所有代码2333
(刚刚写了vault的)作者写了一堆我copy了下挺舒服的
还是想搏一搏了
凉凉丶 发表于 2021-5-1 22:54
我的问的时候就贴了我的步骤的所有代码2333
(刚刚写了vault的)作者写了一堆我copy了下挺舒服的
还是想 ...
https://github.com/PlaceholderAP ... laceholderExpansion
PercyDan 发表于 2021-5-1 22:53
不实例化还想不报null,妈的绝了
用Getter and Setter算是实例化吗
PercyDan 发表于 2021-5-1 23:02
实例化都不懂别整这些
Java基础不行啊
也只是在知道的程度,没写过,点券的作者也莫得给2333
public class 你的插件主类 extends JavaPlugin
{
public static PlayerPoints playerPoints
public void onEnable()
{
playerPoints = PlayerPoints.class.cast(getServer().getPluginManager().getPlugin("PlayerPoints"));
}
}
同样的
应该在你的plugin.yml加上
depend 或 softdepend:
depend:
- PlayerPoints
{
public static PlayerPoints playerPoints
public void onEnable()
{
playerPoints = PlayerPoints.class.cast(getServer().getPluginManager().getPlugin("PlayerPoints"));
}
}
同样的
应该在你的plugin.yml加上
depend 或 softdepend:
depend:
- PlayerPoints