mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 05:06:45 +01:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
921a0228db
@ -200,15 +200,19 @@ public class PartyCommand implements TabExecutor {
|
||||
|
||||
if (matches.size() == 0) {
|
||||
Player player = (Player) sender;
|
||||
final McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Not Loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
if(mcMMOPlayer == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
Party party = UserManager.getPlayer(player).getParty();
|
||||
if (mcMMOPlayer.getParty() == null)
|
||||
return ImmutableList.of();
|
||||
|
||||
final Party party = mcMMOPlayer.getParty();
|
||||
|
||||
playerNames = party.getOnlinePlayerNames(player);
|
||||
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<>(playerNames.size()));
|
||||
|
@ -25,7 +25,7 @@ public class PartyRenameCommand implements CommandExecutor {
|
||||
Party playerParty = mcMMOPlayer.getParty();
|
||||
|
||||
String oldPartyName = playerParty.getName();
|
||||
String newPartyName = args[1];
|
||||
String newPartyName = args[1].replace(".", "");
|
||||
|
||||
// This is to prevent party leaders from spamming other players with the rename message
|
||||
if (oldPartyName.equalsIgnoreCase(newPartyName)) {
|
||||
|
@ -450,6 +450,9 @@ public class PlayerListener implements Listener {
|
||||
case CAUGHT_FISH:
|
||||
if(caught instanceof Item) {
|
||||
if(ExperienceConfig.getInstance().isFishingExploitingPrevented()) {
|
||||
|
||||
fishingManager.processExploiting(event.getHook().getLocation().toVector());
|
||||
|
||||
if (fishingManager.isExploitingFishing(event.getHook().getLocation().toVector())) {
|
||||
player.sendMessage(LocaleLoader.getString("Fishing.ScarcityTip", ExperienceConfig.getInstance().getFishingExploitingOptionMoveRange()));
|
||||
event.setExpToDrop(0);
|
||||
|
@ -28,6 +28,7 @@ import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public final class PartyManager {
|
||||
private static final String partiesFilePath = mcMMO.getFlatFileDirectory() + "parties.yml";
|
||||
@ -609,6 +610,7 @@ public final class PartyManager {
|
||||
ArrayList<Party> hasAlly = new ArrayList<>();
|
||||
|
||||
for (String partyName : partiesFile.getConfigurationSection("").getKeys(false)) {
|
||||
try {
|
||||
Party party = new Party(partyName);
|
||||
|
||||
String[] leaderSplit = partiesFile.getString(partyName + ".Leader").split("[|]");
|
||||
@ -637,6 +639,9 @@ public final class PartyManager {
|
||||
}
|
||||
|
||||
parties.add(party);
|
||||
} catch (Exception e) {
|
||||
mcMMO.p.getLogger().log(Level.WARNING, "An exception occurred while loading a party with name '" + partyName + "'. Skipped loading party.", e);
|
||||
}
|
||||
}
|
||||
|
||||
mcMMO.p.debug("Loaded (" + parties.size() + ") Parties...");
|
||||
|
@ -51,6 +51,7 @@ public class FishingManager extends SkillManager {
|
||||
private long lastWarnedExhaust = 0L;
|
||||
private FishHook fishHookReference;
|
||||
private BoundingBox lastFishingBoundingBox;
|
||||
private boolean sameTarget;
|
||||
private Item fishingCatch;
|
||||
private Location hookLocation;
|
||||
private int fishCaughtCounter = 1;
|
||||
@ -125,6 +126,25 @@ public class FishingManager extends SkillManager {
|
||||
return hasFished;
|
||||
}
|
||||
|
||||
public void processExploiting(Vector centerOfCastVector) {
|
||||
BoundingBox newCastBoundingBox = makeBoundingBox(centerOfCastVector);
|
||||
this.sameTarget = lastFishingBoundingBox != null && lastFishingBoundingBox.overlaps(newCastBoundingBox);
|
||||
|
||||
if (this.sameTarget) {
|
||||
fishCaughtCounter++;
|
||||
}
|
||||
else {
|
||||
fishCaughtCounter = 1;
|
||||
}
|
||||
|
||||
//If the new bounding box does not intersect with the old one, then update our bounding box reference
|
||||
if (!this.sameTarget) lastFishingBoundingBox = newCastBoundingBox;
|
||||
|
||||
if (fishCaughtCounter + 1 == ExperienceConfig.getInstance().getFishingExploitingOptionOverFishLimit()) {
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Fishing.LowResourcesTip", ExperienceConfig.getInstance().getFishingExploitingOptionMoveRange()));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isExploitingFishing(Vector centerOfCastVector) {
|
||||
|
||||
/*Block targetBlock = getPlayer().getTargetBlock(BlockUtils.getTransparentBlocks(), 100);
|
||||
@ -133,25 +153,7 @@ public class FishingManager extends SkillManager {
|
||||
return false;
|
||||
}*/
|
||||
|
||||
BoundingBox newCastBoundingBox = makeBoundingBox(centerOfCastVector);
|
||||
|
||||
boolean sameTarget = lastFishingBoundingBox != null && lastFishingBoundingBox.overlaps(newCastBoundingBox);
|
||||
|
||||
if(sameTarget)
|
||||
fishCaughtCounter++;
|
||||
else
|
||||
fishCaughtCounter = 1;
|
||||
|
||||
if(fishCaughtCounter + 1 == ExperienceConfig.getInstance().getFishingExploitingOptionOverFishLimit())
|
||||
{
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Fishing.LowResourcesTip", ExperienceConfig.getInstance().getFishingExploitingOptionMoveRange()));
|
||||
}
|
||||
|
||||
//If the new bounding box does not intersect with the old one, then update our bounding box reference
|
||||
if(!sameTarget)
|
||||
lastFishingBoundingBox = newCastBoundingBox;
|
||||
|
||||
return sameTarget && fishCaughtCounter >= ExperienceConfig.getInstance().getFishingExploitingOptionOverFishLimit();
|
||||
return this.sameTarget && fishCaughtCounter >= ExperienceConfig.getInstance().getFishingExploitingOptionOverFishLimit();
|
||||
}
|
||||
|
||||
public static BoundingBox makeBoundingBox(Vector centerOfCastVector) {
|
||||
|
Loading…
Reference in New Issue
Block a user