Y E E H A W
Added error message if needed for member assigning Fixed #65, #63 /yeehaw
This commit is contained in:
parent
a75397f2b0
commit
5872117d28
3 changed files with 12 additions and 5 deletions
|
@ -13,6 +13,9 @@
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
|
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
|
||||||
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
|
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
|
||||||
|
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
|
||||||
|
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
|
||||||
|
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
|
||||||
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.10" level="project" />
|
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.10" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.google.code.findbugs:annotations:2.0.1" level="project" />
|
<orderEntry type="library" name="Maven: com.google.code.findbugs:annotations:2.0.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.javassist:javassist:3.20.0-GA" level="project" />
|
<orderEntry type="library" name="Maven: org.javassist:javassist:3.20.0-GA" level="project" />
|
||||||
|
|
|
@ -54,9 +54,12 @@ public class MemberComponent extends Component<MainPlugin> implements Listener {
|
||||||
if (permission != null && !permission.playerInGroup(event.getPlayer(), memberGroup().get())
|
if (permission != null && !permission.playerInGroup(event.getPlayer(), memberGroup().get())
|
||||||
&& (new Date(event.getPlayer().getFirstPlayed()).toInstant().plus(registeredForDays().get(), ChronoUnit.DAYS).isBefore(Instant.now())
|
&& (new Date(event.getPlayer().getFirstPlayed()).toInstant().plus(registeredForDays().get(), ChronoUnit.DAYS).isBefore(Instant.now())
|
||||||
|| event.getPlayer().getStatistic(Statistic.PLAY_ONE_TICK) > 20 * 3600 * playedHours().get())) {
|
|| event.getPlayer().getStatistic(Statistic.PLAY_ONE_TICK) > 20 * 3600 * playedHours().get())) {
|
||||||
permission.playerAddGroup(null, event.getPlayer(), memberGroup().get());
|
if (permission.playerAddGroup(null, event.getPlayer(), memberGroup().get())) {
|
||||||
event.getPlayer().sendMessage("§bYou are a member now. YEEHAW");
|
event.getPlayer().sendMessage("§bYou are a member now. YEEHAW");
|
||||||
MainPlugin.Instance.getLogger().info("Added " + event.getPlayer().getName() + " as a member.");
|
MainPlugin.Instance.getLogger().info("Added " + event.getPlayer().getName() + " as a member.");
|
||||||
|
} else {
|
||||||
|
MainPlugin.Instance.getLogger().warning("Failed to assign the member role! Please make sure the member group exists or disable the component if it's unused.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import org.bukkit.permissions.PermissionDefault;
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
public class Command2MC extends Command2<ICommand2MC, Command2MCSender> {
|
public class Command2MC extends Command2<ICommand2MC, Command2MCSender> {
|
||||||
|
@ -56,8 +57,8 @@ public class Command2MC extends Command2<ICommand2MC, Command2MCSender> {
|
||||||
if (sender.getSender() instanceof Player)
|
if (sender.getSender() instanceof Player)
|
||||||
p = MainPlugin.permission.playerHas(null, (OfflinePlayer) sender.getSender(), perm);
|
p = MainPlugin.permission.playerHas(null, (OfflinePlayer) sender.getSender(), perm);
|
||||||
else
|
else
|
||||||
p = MainPlugin.permission.groupHas((String) null, MainPlugin.Instance.unconnPermGroup().get(), perm);
|
//p = MainPlugin.permission.groupHas((String) null, MainPlugin.Instance.unconnPermGroup().get(), perm);
|
||||||
System.out.println("Has permission " + perm + ": " + p);
|
p = MainPlugin.permission.playerHas(null, Bukkit.getOfflinePlayer(new UUID(0, 0)), perm);
|
||||||
} else break; //If any of the permissions aren't granted then don't allow
|
} else break; //If any of the permissions aren't granted then don't allow
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue