mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-10-24 05:20:55 +02:00
Fixes
This commit is contained in:
parent
2645dc40f7
commit
2f0c1949c2
@ -2,6 +2,13 @@ package net.citizensnpcs.commands;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import com.google.common.base.Joiner;
|
||||||
|
import com.google.common.base.Splitter;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net.citizensnpcs.api.CitizensAPI;
|
import net.citizensnpcs.api.CitizensAPI;
|
||||||
import net.citizensnpcs.api.command.Command;
|
import net.citizensnpcs.api.command.Command;
|
||||||
import net.citizensnpcs.api.command.CommandConfigurable;
|
import net.citizensnpcs.api.command.CommandConfigurable;
|
||||||
@ -16,13 +23,6 @@ import net.citizensnpcs.api.util.Messaging;
|
|||||||
import net.citizensnpcs.util.Messages;
|
import net.citizensnpcs.util.Messages;
|
||||||
import net.citizensnpcs.util.StringHelper;
|
import net.citizensnpcs.util.StringHelper;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
|
|
||||||
import com.google.common.base.Joiner;
|
|
||||||
import com.google.common.base.Splitter;
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
|
|
||||||
@Requirements(selected = true, ownership = true)
|
@Requirements(selected = true, ownership = true)
|
||||||
public class TraitCommands {
|
public class TraitCommands {
|
||||||
@Command(
|
@Command(
|
||||||
@ -30,12 +30,12 @@ public class TraitCommands {
|
|||||||
usage = "add [trait name]...",
|
usage = "add [trait name]...",
|
||||||
desc = "Adds traits to the NPC",
|
desc = "Adds traits to the NPC",
|
||||||
modifiers = { "add", "a" },
|
modifiers = { "add", "a" },
|
||||||
min = 1,
|
min = 2,
|
||||||
permission = "citizens.npc.trait")
|
permission = "citizens.npc.trait")
|
||||||
public void add(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
|
public void add(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
|
||||||
List<String> added = Lists.newArrayList();
|
List<String> added = Lists.newArrayList();
|
||||||
List<String> failed = Lists.newArrayList();
|
List<String> failed = Lists.newArrayList();
|
||||||
for (String traitName : Splitter.on(',').split(args.getJoinedStrings(0))) {
|
for (String traitName : Splitter.on(',').split(args.getJoinedStrings(1))) {
|
||||||
if (!sender.hasPermission("citizens.npc.trait." + traitName)
|
if (!sender.hasPermission("citizens.npc.trait." + traitName)
|
||||||
&& !sender.hasPermission("citizens.npc.trait.*")) {
|
&& !sender.hasPermission("citizens.npc.trait.*")) {
|
||||||
failed.add(String.format("%s: No permission", traitName));
|
failed.add(String.format("%s: No permission", traitName));
|
||||||
|
@ -291,7 +291,7 @@ public class CitizensNPC extends AbstractNPC {
|
|||||||
&& getEntity().getWorld().getFullTime() % Setting.PACKET_UPDATE_DELAY.asInt() == 0) {
|
&& getEntity().getWorld().getFullTime() % Setting.PACKET_UPDATE_DELAY.asInt() == 0) {
|
||||||
if (getEntity() instanceof LivingEntity) {
|
if (getEntity() instanceof LivingEntity) {
|
||||||
if (!getEntity().isCustomNameVisible()) {
|
if (!getEntity().isCustomNameVisible()) {
|
||||||
getEntity().setCustomName("");
|
getEntity().setCustomName("&2");
|
||||||
} else {
|
} else {
|
||||||
getEntity().setCustomName(getFullName());
|
getEntity().setCustomName(getFullName());
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package net.citizensnpcs.npc.ai;
|
package net.citizensnpcs.npc.ai;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.ai.AttackStrategy;
|
import net.citizensnpcs.api.ai.AttackStrategy;
|
||||||
import net.citizensnpcs.api.ai.EntityTarget;
|
import net.citizensnpcs.api.ai.EntityTarget;
|
||||||
import net.citizensnpcs.api.ai.NavigatorParameters;
|
import net.citizensnpcs.api.ai.NavigatorParameters;
|
||||||
@ -13,10 +17,6 @@ import net.minecraft.server.v1_8_R3.EntityLiving;
|
|||||||
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||||
import net.minecraft.server.v1_8_R3.NavigationAbstract;
|
import net.minecraft.server.v1_8_R3.NavigationAbstract;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
|
|
||||||
public class MCTargetStrategy implements PathStrategy, EntityTarget {
|
public class MCTargetStrategy implements PathStrategy, EntityTarget {
|
||||||
private final boolean aggro;
|
private final boolean aggro;
|
||||||
private int attackTicks;
|
private int attackTicks;
|
||||||
@ -117,9 +117,10 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
|
|||||||
}
|
}
|
||||||
if (!aggro && distanceSquared() < parameters.distanceMargin()) {
|
if (!aggro && distanceSquared() < parameters.distanceMargin()) {
|
||||||
stop();
|
stop();
|
||||||
} else if (target.world.getWorld().getFullTime() % 10 == 0) {
|
} else if (target.world.getWorld().getFullTime() % 40 == 0) {
|
||||||
setPath();
|
setPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
NMS.look(handle, target);
|
NMS.look(handle, target);
|
||||||
if (aggro && canAttack()) {
|
if (aggro && canAttack()) {
|
||||||
AttackStrategy strategy = parameters.attackStrategy();
|
AttackStrategy strategy = parameters.attackStrategy();
|
||||||
|
@ -100,7 +100,6 @@ public class HumanController extends AbstractEntityController {
|
|||||||
msb |= 0x0000000000002000L;
|
msb |= 0x0000000000002000L;
|
||||||
uuid = new UUID(msb, uuid.getLeastSignificantBits());
|
uuid = new UUID(msb, uuid.getLeastSignificantBits());
|
||||||
}
|
}
|
||||||
|
|
||||||
GameProfile profile = new GameProfile(uuid, coloredName);
|
GameProfile profile = new GameProfile(uuid, coloredName);
|
||||||
updateSkin(npc, nmsWorld, profile);
|
updateSkin(npc, nmsWorld, profile);
|
||||||
|
|
||||||
@ -118,7 +117,7 @@ public class HumanController extends AbstractEntityController {
|
|||||||
|
|
||||||
if (prefixCapture != null) {
|
if (prefixCapture != null) {
|
||||||
Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
|
Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
|
||||||
String teamName = UUID.randomUUID().toString().substring(0,16);
|
String teamName = UUID.randomUUID().toString().substring(0, 16);
|
||||||
|
|
||||||
Team team = scoreboard.getTeam(teamName);
|
Team team = scoreboard.getTeam(teamName);
|
||||||
if (team == null) {
|
if (team == null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user