Skip to content

Commit aa70cdd

Browse files
committed
v1.3.0 fixed bugs and added skull meta cache option
1 parent cc579e5 commit aa70cdd

File tree

6 files changed

+55
-8
lines changed

6 files changed

+55
-8
lines changed

Pages/Connect.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public Connect(string? lastIp)
6161
LoginPacket lp = (LoginPacket)packet;
6262
if (!lp.isAllowed())
6363
{
64+
manager.stop();
6465
MessageBox.Show("Le serveur n'a pas autorisé l'accès à cette ressource.\nRaison: " + lp.getReason(), "Error disallowed", MessageBoxButton.OK, MessageBoxImage.Error);
6566
}
6667
else

Pages/Item.xaml.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,10 @@ private void onMaterialClick(object sender, MouseButtonEventArgs e)
525525
{
526526
tbxMaterial.Text = mat.ToString();
527527
rectOverlayMaterial.ToolTip = (tbxMaterial.Text.Length > 20) ? mat.ToString() : null;
528+
if(itemmeta != null)
529+
{
530+
MessageBox.Show("Un ItemMeta de type " + itemmeta.getMeta().ToString() + " existe encore sur cet Item.\n\nEnvoyer l'item dans cet état au serveur compromettra la configuration!\n\nSolutions;\n1) Remettre un Material qui supporte cet ItemMeta\n2) Cliquer sur le bouton \"Meta perso.\" afin d'actualiser l'ItemMeta pour ce nouveau Material", "Invalid ItemMeta for " + mat, MessageBoxButton.OK, MessageBoxImage.Warning);
531+
}
528532
}
529533
});
530534
}

Pages/Meta/Skull.xaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,22 @@
99

1010
<Grid x:Name="PageSkull">
1111
<Label x:Name="lblTitle" Style="{StaticResource lblFont1}" FontSize="30" Content="ItemMeta(Skull) de [I]" HorizontalAlignment="Center" VerticalAlignment="Top"/>
12-
<Label x:Name="lblType" ToolTip="PLAYER = Joueur dynamique (Celui qui complète le challenge p.exemple)&#xA;//!!\\ NE PAS METTRE 'PLAYER' SI C'EST POUR UN ITEM REQUIS //!!\\&#xA;PSEUDO = Pseudo de joueur fixe (Luca008 p.exemple)&#xA;MCHEADS = Une tête customisée du site minecraft-heads.com (Tête en question->Tout en bas->Value)" Content="Type :" Style="{StaticResource ResourceKey=lblFont1}" FontSize="25" HorizontalAlignment="Left" Margin="65,144,0,0" VerticalAlignment="Top" VerticalContentAlignment="Center" Height="38" Width="118"/>
13-
<ComboBox x:Name="cbxType" SelectedIndex="0" VerticalContentAlignment="Center" HorizontalAlignment="Left" Margin="188,150,0,0" Style="{StaticResource lblFont1}" FontSize="20" VerticalAlignment="Top" Width="100" Height="28" SelectionChanged="cbxType_SelecChanged">
12+
<Label x:Name="lblType" ToolTip="PLAYER = Joueur dynamique (Celui qui complète le challenge p.exemple)&#xA;//!!\\ NE PAS METTRE 'PLAYER' SI C'EST POUR UN ITEM REQUIS //!!\\&#xA;PSEUDO = Pseudo de joueur fixe (Luca008 p.exemple)&#xA;MCHEADS = Une tête customisée du site minecraft-heads.com (Tête en question->Tout en bas->Value)" Content="Type :" Style="{StaticResource ResourceKey=lblFont1}" FontSize="25" HorizontalAlignment="Left" Margin="65,144,0,0" VerticalAlignment="Top" VerticalContentAlignment="Center" Height="38" Width="200"/>
13+
<ComboBox x:Name="cbxType" SelectedIndex="0" VerticalContentAlignment="Center" HorizontalAlignment="Left" Margin="270,150,0,0" Style="{StaticResource lblFont1}" FontSize="20" VerticalAlignment="Top" Width="100" Height="28" SelectionChanged="cbxType_SelecChanged">
1414
<ComboBoxItem Content="PLAYER"/>
1515
<ComboBoxItem Content="PSEUDO"/>
1616
<ComboBoxItem Content="MCHEADS"/>
1717
</ComboBox>
18-
<Label x:Name="lblValue" Content="Valeur :" Style="{StaticResource ResourceKey=lblFont1}" FontSize="25" HorizontalAlignment="Left" Margin="65,226,0,0" VerticalAlignment="Top" VerticalContentAlignment="Center" Height="38" Width="118"/>
19-
<TextBox x:Name="tbxValue" IsEnabled="False" HorizontalAlignment="Left" VerticalContentAlignment="Center" Style="{StaticResource lblFont1}" FontSize="20" Margin="188,232,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="190" Height="25"/>
18+
<Label x:Name="lblValue" Content="Valeur :" Style="{StaticResource ResourceKey=lblFont1}" FontSize="25" HorizontalAlignment="Left" Margin="65,226,0,0" VerticalAlignment="Top" VerticalContentAlignment="Center" Height="38" Width="200"/>
19+
<TextBox x:Name="tbxValue" IsEnabled="False" HorizontalAlignment="Left" VerticalContentAlignment="Center" Style="{StaticResource lblFont1}" FontSize="20" Margin="270,232,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="190" Height="25"/>
20+
<Canvas x:Name="cvCache" Visibility="Hidden">
21+
<Canvas x:Name="cvCacheError" Visibility="Hidden">
22+
<Label Content="Le texte entré n'est pas un entier entre 0 et 2'419'200 (1 semaine)." HorizontalAlignment="Left" VerticalAlignment="Top" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Style="{StaticResource ResourceKey=lblFont1}" FontSize="15" Width="366" Height="25" Margin="65,340,0,0" Foreground="Red"/>
23+
<Label Content="⚠️ Il sera remplacé par 3600 lors de la sauvegarde sur le serveur. ⚠️" HorizontalAlignment="Left" VerticalAlignment="Top" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Style="{StaticResource ResourceKey=lblFont1}" FontSize="15" Width="400" Height="25" Margin="65,360,0,0" Foreground="Red"/>
24+
</Canvas>
25+
<Label x:Name="lblCache" Content="Cache (secondes) :" ToolTip="Combien de temps la texture du skin reste en mémoire avant que le plugin renvoie une requête aux serveurs Mojang. (Mettre 0 pour désactiver le caching)" Style="{StaticResource ResourceKey=lblFont1}" FontSize="25" HorizontalAlignment="Left" Margin="65,308,0,0" VerticalAlignment="Top" VerticalContentAlignment="Center" Height="38" Width="200"/>
26+
<TextBox x:Name="tbxCache" HorizontalAlignment="Left" VerticalContentAlignment="Center" Text="3600" Style="{StaticResource lblFont1}" FontSize="20" Margin="270,314,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="100" Height="25" TextChanged="tbxCache_TextChanged"/>
27+
</Canvas>
2028
<Polygon x:Name="btnBack" Cursor="Hand" Points="40,0 40,40 0,20" Stroke="Black" Fill="Black" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="21,10,0,0" Width="40" Height="40" MouseEnter="btnBack_MouseEnter" MouseLeave="btnBack_MouseLeave" MouseUp="btnBack_Click">
2129
<Polygon.RenderTransform>
2230
<ScaleTransform ScaleX="1" ScaleY="1"/>

Pages/Meta/Skull.xaml.cs

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ namespace Challenges_App.Pages.Meta
1414
public partial class Skull : Page, IMeta
1515
{
1616
private Item parent;
17+
18+
private int minCache = 0;
19+
private int maxCache = 2_419_200; //1 week / 7 days
20+
private Func<int, bool> ValidateCache => cache => cache >= minCache && cache <= maxCache;
21+
1722
public Skull(Item parent)
1823
{
1924
this.parent = parent;
@@ -38,6 +43,10 @@ public Skull(Item parent, JObject json) : this(parent)
3843
{
3944
tbxValue.Text = json.Value<String>("Owner");
4045
}
46+
if(json.ContainsKey("UseCache"))
47+
{
48+
tbxCache.Text = json.Value<Int32>("UseCache").ToString();
49+
}
4150
}
4251

4352
IMeta.Meta IMeta.getMeta()
@@ -58,10 +67,27 @@ JObject IMeta.toJson()
5867
if (!type.Equals("PLAYER"))
5968
{
6069
json["Owner"] = tbxValue.Text;
61-
}
70+
}
71+
if(type.Equals("PSEUDO"))
72+
{
73+
if(Int32.TryParse(tbxCache.Text, out var cache) && ValidateCache(cache))
74+
{
75+
json["UseCache"] = cache;
76+
} else {
77+
json["UseCache"] = 3600;
78+
// Just update the GUI field in case the player saves this item (either by saving it locally or sending it to the server by sending a challenge using it)
79+
// and then later on come back on this page, to avoid desync
80+
tbxCache.Text = "3600";
81+
}
82+
}
6283
return json;
6384
}
6485

86+
private void tbxCache_TextChanged(object sender, TextChangedEventArgs e)
87+
{
88+
cvCacheError.Visibility = Int32.TryParse(tbxCache.Text, out var cache) && ValidateCache(cache) ? Visibility.Hidden : Visibility.Visible;
89+
}
90+
6591
private void cbxType_SelecChanged(object sender, SelectionChangedEventArgs e)
6692
{
6793
if (tbxValue == null) return;
@@ -73,20 +99,26 @@ private void cbxType_SelecChanged(object sender, SelectionChangedEventArgs e)
7399
tbxValue.Height = 25;
74100
tbxValue.IsEnabled = false;
75101
tbxValue.Text = "";
102+
cvCache.Visibility = Visibility.Hidden;
103+
tbxCache.Text = "";
76104
}
77105
break;
78106
case 1: //PSEUDO
79107
{
80108
tbxValue.Width = 190;
81109
tbxValue.Height = 25;
82110
tbxValue.IsEnabled = true;
111+
cvCache.Visibility = Visibility.Visible;
112+
tbxCache.Text = "3600";
83113
}
84114
break;
85115
case 2: //MCHEADS
86116
{
87-
tbxValue.Width = 540;
117+
tbxValue.Width = 500;
88118
tbxValue.Height = 90;
89119
tbxValue.IsEnabled = true;
120+
cvCache.Visibility = Visibility.Hidden;
121+
tbxCache.Text = "";
90122
}
91123
break;
92124
}
@@ -112,5 +144,6 @@ private void btnBack_Click(object sender, MouseButtonEventArgs e)
112144
{
113145
MainWindow.Instance.MainFrame.Navigate(parent);
114146
}
147+
115148
}
116149
}

Properties/PublishProfiles/FolderProfile.pubxml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
55
<Project>
66
<PropertyGroup>
77
<Configuration>Release</Configuration>
8-
<Platform>Any CPU</Platform>
8+
<Platform>x64</Platform>
99
<PublishDir>bin\Release\publish\</PublishDir>
1010
<PublishProtocol>FileSystem</PublishProtocol>
1111
<TargetFramework>net6.0-windows</TargetFramework>
1212
<SelfContained>false</SelfContained>
1313
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
1414
<PublishReadyToRun>false</PublishReadyToRun>
15+
<PublishSingleFile>true</PublishSingleFile>
1516
</PropertyGroup>
1617
</Project>

Properties/PublishProfiles/FolderProfile.pubxml.user

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
44
-->
55
<Project>
66
<PropertyGroup>
7-
<History>True|2025-02-20T18:33:04.0664270Z||;True|2025-02-03T00:16:23.8815363+01:00||;True|2025-02-03T00:15:00.3025328+01:00||;True|2023-10-14T15:02:18.7626300+02:00||;True|2023-10-14T13:52:30.4135204+02:00||;True|2023-10-13T22:55:47.4867070+02:00||;True|2023-10-13T22:55:27.6407595+02:00||;True|2023-10-13T22:54:59.5717476+02:00||;True|2023-10-13T22:53:20.5445468+02:00||;True|2022-08-21T17:07:33.5385272+02:00||;True|2022-07-23T22:23:59.7845278+02:00||;True|2022-01-17T20:51:22.3444736+01:00||;True|2022-01-17T15:24:11.0506125+01:00||;True|2022-01-17T15:22:51.3003623+01:00||;True|2022-01-17T15:22:04.6797333+01:00||;False|2022-01-17T15:20:15.9710703+01:00||;False|2022-01-17T15:19:50.4001956+01:00||;True|2022-01-17T15:18:44.5443997+01:00||;True|2022-01-17T15:16:58.3305098+01:00||;True|2022-01-17T15:16:03.5282079+01:00||;</History>
7+
<History>True|2025-10-12T21:06:05.3757716Z||;True|2025-10-12T23:00:30.8474538+02:00||;True|2025-10-12T22:55:29.5403998+02:00||;True|2025-10-12T22:54:51.1519277+02:00||;True|2025-10-12T22:53:58.9278789+02:00||;True|2025-10-12T22:52:14.3659738+02:00||;True|2025-02-20T19:33:04.0664270+01:00||;True|2025-02-03T00:16:23.8815363+01:00||;True|2025-02-03T00:15:00.3025328+01:00||;True|2023-10-14T15:02:18.7626300+02:00||;True|2023-10-14T13:52:30.4135204+02:00||;True|2023-10-13T22:55:47.4867070+02:00||;True|2023-10-13T22:55:27.6407595+02:00||;True|2023-10-13T22:54:59.5717476+02:00||;True|2023-10-13T22:53:20.5445468+02:00||;True|2022-08-21T17:07:33.5385272+02:00||;True|2022-07-23T22:23:59.7845278+02:00||;True|2022-01-17T20:51:22.3444736+01:00||;True|2022-01-17T15:24:11.0506125+01:00||;True|2022-01-17T15:22:51.3003623+01:00||;True|2022-01-17T15:22:04.6797333+01:00||;False|2022-01-17T15:20:15.9710703+01:00||;False|2022-01-17T15:19:50.4001956+01:00||;True|2022-01-17T15:18:44.5443997+01:00||;True|2022-01-17T15:16:58.3305098+01:00||;True|2022-01-17T15:16:03.5282079+01:00||;</History>
88
<LastFailureDetails />
99
</PropertyGroup>
1010
</Project>

0 commit comments

Comments
 (0)